Alguns códigos em c

417 palavras 2 páginas
#include
#include
#include
#include

#define CIMA 1
#define BAIXO 2
#define ESQUERDA 3
#define DIREITA 4

// Variaveis de status
GLint lvl = 1;
GLint bComidas = 0;
GLint tamanho = 0;
GLbyte gameOver = true;

// Variaveis da cobrinha
GLint corpoPos[2][40] = {{}};
GLint _x = 10;
GLint _y = 20;
GLint _oldX[2] = {};
GLint _oldY[2] = {};
GLbyte direcao = 0;

// Variaveis da comidinha
GLint _bx = 0;
GLint _by = 0;

// Variaveis da tela
GLint _w = 400;
GLint _h = 350;
GLint _Giw = 10;
GLint _Gih = 30;
GLint _Gfw = 270;
GLint _Gfh = 240;

// Variaveis para verificação de FPS
DWORD g_dwLastFPS = 0; int g_nFPS = 0, g_nFrames = 0;

// Variaveis do mouse
//GLint Tx = 0;
//GLint Ty = 0;

void resetaJogo(){ _x = 10; _y = 20; direcao = 0; lvl = 1; bComidas = 0; tamanho = 0; gameOver = false;
}

void Escreve(char *string){ while(*string) glutBitmapCharacter(GLUT_BITMAP_8_BY_13, *string++);
}

void fTitulo(){ char tmp_str[40]; // Titulo glColor3f(0, 0, 0); glRectf(_Giw, _Gih, _Gfw, _Gfh); glColor3f(1, 1, 1); glRasterPos2f(85, 210); Escreve("Jogo da Cobrinha");

glColor3f(.4, .4, .4); glRectf(65, 180, 200, 195); glColor3f(1, 1, 1); glRasterPos2f(105, 185); Escreve("Novo jogo"); // Mouse /* glColor3f(0, 0, 0); glRasterPos2f(10, 10); sprintf(tmp_str, "x: %d, y: %d", Tx, Ty); Escreve(tmp_str); */
}

void updateCobrinha(){ int i; // Cobrinha // Cabeça glPushMatrix(); glTranslatef(_x,_y,0.0); glColor3f(1, 0, 0); glRectf(10.0f, 10.0f, 20.0f, 20.0f); glPopMatrix();

// Corpo for(i=0; i _Gfh-20) _y = _Gih-10; break; case BAIXO:

Relacionados

  • tecnologia
    443 palavras | 2 páginas
  • Linguagem para Programar Microcontroladores: Assembly, C ou Basic
    4222 palavras | 17 páginas
  • blab
    2797 palavras | 12 páginas
  • Dev C++
    1890 palavras | 8 páginas
  • Quero Aprender o C++ e agora?
    2503 palavras | 11 páginas
  • trabalho feito
    410 palavras | 2 páginas
  • C sharp
    1058 palavras | 5 páginas
  • Ciencias da computaçao
    3043 palavras | 13 páginas
  • Analista de sistemas
    5869 palavras | 24 páginas
  • Direito e Legislação
    1608 palavras | 7 páginas