3

C++ Strings, SFML Time: Player Input and HUD

Almost every game ever made will need to have some text on the screen – the score, the text of a character’s speech, and many other examples. Therefore, in this chapter, we will spend around half the time learning how to manipulate text and display it on the screen and the other half looking at timing and how a visual time-bar can inform the player of their remaining time and create a sense of urgency in the game.

We will cover the foallowing:

  • Pausing and restarting the game
  • C++ strings
  • SFML Text and SFML Font
  • Adding a score and a message
  • Adding a time-bar

As we progress with this game over the next three chapters, the code will get longer and longer. So, now seems like a good time to think ahead ...

Get Beginning C++ Game Programming - Third Edition 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.