Composing our world

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 ...

Get SFML Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.