Coding the Screen class and its dependents
What we will do now is code all the screen-related classes. In addition, each of the screens from our game will have their own specific implementation of all these classes.
Next, we will code all the base classes; Screen
, InputHandler
, UIPanel
, and Button
. Following that, we will do the full implementation of the SelectScreen
derivations of these classes and a partial implementation of the GameScreen
derivations. At this point, we will be able to run the game and see our screens, UI panels, and buttons in action, and also be able to switch between screens. In the next chapter, we will work on the game properly and implement GameObject
and LevelManager
. In Chapter 22, Using Game Objects and Building a Game, we will see how we can use them all in the GameScreen
class.
Coding the Button class
Create a new header file in the Header Files/Screens
filter called Button.h
and add the following code:
#pragma once #include <SFML/Graphics...