O'Reilly logo

SFML Game Development by Henrik Vogelius Hansson, Artur Moreira, Jan Haller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required