
//Say you have a game that looks something like this:
struct Game {
	Game(); //loads things
	~Game(); //unloads things

	void handle_input(Input i);
	void update(float elapsed_time);
	/* //implementation of 'update' if you want to use fixed-step updating instead of variable-time:
	void tick(); //update for 1.0f / 60.0f of a second
	float time_acc = 0.0f;
	void update(float elapsed_time) {
		time_acc += elapsed_time;
		while (time_acc >= 0.0f) {
			time_acc -= 1.0f / 60.0f;
			tick();
		}
	} */

	void draw();

	bool is_finished = false;
};

//Then you might write a main loop that looks like this:
int main(int argc, char **argv) {
	Game game; //<-- load resources

	while (!game.is_finished) {
		//Handles inputs:
		Input input;
		while (poll_input(&input)) {
			game.handle_input(input);
		}
		//Updates for elapsed time:
		float t = get_elapsed_time();
		t = std::min(t, 0.1f); //<--- to avoid exponential growth in update time when update(t) takes > t seconds.
		game.update(t);

		//Draw some things:
		game.draw();

		//Present the framebuffer:
		swap_and_vsync();
	}
	return 0;
}
