June 2013
Beginner to intermediate
296 pages
6h 50m
English
By now we already know how the
Game class works, what a game loop is for, and how to take advantage of it. For this chapter, we take the previously used Game class, and plug into it our newcomer World class.
Because we obeyed a few principles, this integration is very easy and it's just a matter of having a World object inside the
Game class, and then letting it update and draw itself in the appropriate times.
Our application's
main() function has a simple job. It allocates a Game object, and lets it run itself through the run() method. When the run() method exits, the program releases its resources and closes.
Therefore, it is within the run() method that the magic happens! It is responsible for managing ...
Read now
Unlock full access