Up to now, we have taken a look at entities and the scene graph, we know how to render and update objects in the world, and we have seen how views and scrolling work. We have a concrete knowledge about many building blocks, now it is time to assemble them to shape a model of our fictional world.
Completely unforeseen, we create a new class called
World. On one side, our
World class must contain all the data related to rendering:
A reference to the render window
The world's current view
A texture holder with all the textures needed inside the world
The scene graph
Some pointers to access the scene graph's layer nodes
On the other hand, we store some logical data:
The bounding rectangle of the world, storing its dimensions
The position where the player's plane appears in the beginning
The speed with which the world is scrolled
A pointer to the player's aircraft
Concerning functionality, we implement public functions to update and draw the world. We also add two private functions to...