Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char** argv) {
- //atexit(cleanup);
- //freopen( "CON", "wt", stdout );
- //freopen( "CON", "wt", stderr );
- /*
- if (argc == 2 && strcmp("--test", argv[1]) == 0) {
- const char* dummy[] = {"", "-v"};
- return CommandLineTestRunner::RunAllTests(2, dummy);
- }*/
- //*
- if( init_SDL() != 0) {
- return 1;
- }
- Gamestate* gamestate = new Game();
- gamestate->set_next_state(Gamestate::STATE_GAME);
- gamestate->change_state(gamestate);
- int ticks = 0;
- int time = 0;
- bool running = true;
- while(running) {
- time = SDL_GetTicks();
- gamestate->event_handle();
- gamestate->logic();
- gamestate->change_state(gamestate);
- glClear(GL_COLOR_BUFFER_BIT );
- glLoadIdentity();
- gamestate->render();
- SDL_GL_SwapBuffers();
- ticks = SDL_GetTicks();
- if (FPS_TIME > 0 and (ticks - time) <= FPS_TIME) {
- //SDL_Delay(FPS_TIME - (ticks - time));
- }
- if (gamestate->get_currentState() == Gamestate::STATE_QUIT)
- running = false;
- }
- cleanup();
- //*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement