Summary
In this chapter, we focused on creating flexible, reusable buttons. Even though the UI may not be as fun to code or talk about as gameplay mechanics, to the player, it is just as important. That is why creating a good system to add and manage the UI in an intelligent way is so vital to making a great game.
We took an in-depth look at C++ function pointers and pointers to members. This is well known for being confusing and difficult. However, by mastering the techniques, we could create flexible commands that can call any C style function or C++ object method.
While this technique isn't always needed, in the case of UI, it allowed us to create an incredibly flexible system. Our UI objects and most commands can be set up and read from ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access