rendered paste bodyinner event loop (window resize etc commented out):
while (running) {
// Exit if there are no states left on stack.
if (m_states.size() <= 0) {
running = false;
logMsg("Last state has terminated.");
destroy();
return 0;
}
if (SDL_PollEvent(&event)) {
switch (event.type) {
// Handle all quit requests.
case SDL_QUIT:
running = false;
break;
default:
break;
}
}
if (nextUpdate < getTime()) {
m_states.top()->update();
draw();
nextUpdate = getTime() + (1000 / m_ups);
}
}
// draw():
void Bling::draw() {
// Clear color.
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT);
m_states.top()->draw();
// Swap front and back buffers.
SDL_GL_SwapBuffers();
}