O'Reilly logo

SFML Blueprints by Maxime Barbier

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

Adding a menu to the game

Now that we have all the pieces in place to build a basic menu, let's do it with our fresh GUI. We will build two of them. The main, game-opening one and the pause menu. This will show you the different usage possibilities of our actual GUI.

If you have understood what we have done until now well, you would have noticed that the base component of our GUI is Frame. All the other widgets will be displayed on the top of it. Here is a schema that summarizes the GUI tree hierarchy:

Adding a menu to the game

Each color represents a different type of component. The trunk is sf::RenderWindow and then we have a Frame attached to it with its Layout. And finally ...

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