3 #include "plataformas.h"
7 const int SCREEN_WIDTH
= 640;
8 const int SCREEN_HEIGHT
= 480;
9 const int SCREEN_BPP
= 32;
10 const int FRAMES_PER_SECOND
= 60;
13 const double alturachao
= 400.0;
15 Linha
chao(0.0,alturachao
,SCREEN_WIDTH
,alturachao
);
16 std::vector
<Linha
> mapa
;
21 glClearColor( 1, 1, 1, 0 );
24 glMatrixMode( GL_PROJECTION
);
26 glOrtho( 0, SCREEN_WIDTH
, SCREEN_HEIGHT
, 0, -1, 1 );
28 //Initialize modelview matrix
29 glMatrixMode( GL_MODELVIEW
);
32 //If there was any errors
33 if( glGetError() != GL_NO_ERROR
)
38 //If everything initialized
46 if( SDL_Init( SDL_INIT_EVERYTHING
) < 0 )
52 if( SDL_SetVideoMode( SCREEN_WIDTH
, SCREEN_HEIGHT
, SCREEN_BPP
, SDL_OPENGL
) == NULL
)
58 if( init_GL() == false )
64 SDL_WM_SetCaption( "Prototipo Jogo", NULL
);
69 glClear( GL_COLOR_BUFFER_BIT
);
70 std::vector
<Linha
>::iterator it
;
71 for (it
= mapa
.begin(); it
!= mapa
.end(); it
++)
74 glTranslatef(300,300,0);
85 void Game::mainLoop() {
87 luaEnv
.registerScripts();
96 while( SDL_PollEvent( &event
) )
98 if( event
.type
== SDL_QUIT
)
104 if (fps
.get_ticks() < 1000 / FRAMES_PER_SECOND
) {
105 SDL_Delay( ( 1000 / FRAMES_PER_SECOND
) - fps
.get_ticks() );