Implementing menu states

We will now move on to creating a simple menu state with visuals and mouse handling. We will use two new screenshots for our buttons, which are available with the source code downloads:

Implementing menu states

The following screenshot shows the exit feature:

Implementing menu states

These are essentially sprite sheets with the three states of our button. Let's create a new class for these buttons, which we will call MenuButton. Go ahead and create MenuButton.h and MenuButton.cpp. We will start with the header file:

class MenuButton : public SDLGameObject { public: MenuButton(const ...

Get SDL Game Development 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.