All pastes #568451 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-15 15:14 UTC
rendered paste body
inner 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();
}