3 #include "plataformas.h"
9 const int SCREEN_WIDTH
= 640;
10 const int SCREEN_HEIGHT
= 480;
11 const int SCREEN_BPP
= 32;
12 const int FRAMES_PER_SECOND
= 60;
15 const double alturachao
= 400.0;
17 Linha
chao(0.0,alturachao
,SCREEN_WIDTH
,alturachao
);
18 std::vector
<Linha
> mapa
;
19 Player
jogador(SCREEN_WIDTH
/2, SCREEN_HEIGHT
/2);
24 glClearColor( 1, 1, 1, 0 );
27 glMatrixMode( GL_PROJECTION
);
29 glOrtho( 0, SCREEN_WIDTH
, SCREEN_HEIGHT
, 0, -1, 1 );
31 //Initialize modelview matrix
32 glMatrixMode( GL_MODELVIEW
);
35 //If there was any errors
36 if( glGetError() != GL_NO_ERROR
)
41 //If everything initialized
49 if( SDL_Init( SDL_INIT_EVERYTHING
) < 0 )
55 if( SDL_SetVideoMode( SCREEN_WIDTH
, SCREEN_HEIGHT
, SCREEN_BPP
, SDL_OPENGL
) == NULL
)
61 if( init_GL() == false )
67 SDL_WM_SetCaption( "Prototipo Jogo", NULL
);
71 void Game::show(Player jogador
) {
72 glClear( GL_COLOR_BUFFER_BIT
);
74 std::vector
<Linha
>::iterator it
;
75 for (it
= mapa
.begin(); it
!= mapa
.end(); it
++)
78 glTranslatef(300,300,0);
89 void Game::mainLoop() {
91 luaEnv
.registerScripts();
96 Controle
c(Player(0, 0));
102 show(c
.getJogador());
103 if (fps
.get_ticks() < 1000 / FRAMES_PER_SECOND
) {
104 SDL_Delay( ( 1000 / FRAMES_PER_SECOND
) - fps
.get_ticks() );