O'Reilly logo

Beginning C++ Game Programming by John Horton

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

Chapter 10. Layering Views and Implementing the HUD

In this chapter, we will get to see the real value of SFML Views. We will add a large array of SFML Text objects and manipulate them as we did before in the Timber!!! project. What is new is that we will draw the HUD using a second view instance. This way, the HUD will stay neatly positioned over the top of the main game action, regardless of what the background, player, zombies, and other game objects are doing.

Here is what we will do:

  • Add text and a background to the home/game over screen
  • Add text to the level up screen
  • Create the second view
  • Add a HUD

Adding all the Text and HUD objects

We will be manipulating a few Strings in this chapter. This is so we can format the HUD and the level up screen. ...

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