Most games have menus and it's something the player expects when opening up a new game. Even in its simplest form, there is a user interface that responds to the user, and gives him the information he needs to enjoy the game. You might have noticed that we implemented a simple menu in the previous chapter, but it's a prime example where you should refactor and extract into its own class. This is what we will do in this chapter:
Design a user interface components hierarchy
Implement the base component class
Implement containers, labels, and buttons
Create a proper title screen
Create a settings screen
What we aim in this chapter is to give you a fundamental understanding of creating a graphical user interface (GUI). GUI design is a huge topic that deserves its own book, but we will do a crash course together.
Normally, in a GUI you use the mouse as an input source; you click on a button and something happens. But for our examples we keep it simple...