December 2015
Beginner to intermediate
522 pages
11h 21m
English
We've done a good job at wrapping up the basic functionality of our window class, but that's not the only chunk of code in need of refactoring. In Chapter 1, It's Alive! It's Alive! – Setup and First Program, we've discussed the main game loop and its contents, mainly processing input, updating the game world and the player, and finally, rendering everything on screen. Cramming all of that functionality into the game loop alone is generally known to produce spaghetti code, and since we want to move away from that, let's consider a better structure that would allow this kind of behavior:
#include "Game.h" void main(int argc, void** argv[]){ // Program entry point. Game game; // Creating our game object. while(!game.GetWindow()->IsDone()){ ...Read now
Unlock full access