Created
July 8, 2012 11:56
-
-
Save aib/3070645 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (runMainLoop) { | |
while (SDL_PollEvent(&event)) { | |
if (event.type == SDL_QUIT) { | |
runMainLoop = false; | |
} | |
} | |
keystate = SDL_GetKeyState(NULL); | |
buttonstate = SDL_GetMouseState(&mousex, &mousey); | |
cont->mouseMove(mousex, mousey); | |
cont->updateFromSDLKeyState(keystate, buttonstate); | |
//Draw the scene | |
Uint32 curTime = SDL_GetTicks(); | |
if ((curTime-lastThinkTime) >= (1000 / THINKS_PER_SEC)) { | |
// p->Think(); | |
lastThinkTime = curTime; | |
} | |
double framesElapsed = ((double)(curTime-lastFrameTime) / (double)(1000 / THINKS_PER_SEC)); | |
glClear(GL_COLOR_BUFFER_BIT); | |
cont->Update(framesElapsed); | |
p->Update(framesElapsed); | |
updateEntities(framesElapsed); | |
m->Draw(framesElapsed); | |
p->Draw(); | |
lastFrameTime = curTime; | |
SDL_GL_SwapBuffers(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment