Scores and the HUD

The HUD objects will never be rotated. In addition, they are defined in the InputController class based on screen coordinates, not the game world or even Open GL coordinates. Therefore, our GameObject class is not a suitable parent class.

For the sake of simplicity, each of the three HUD classes will have their own draw method. We will see how we draw them at a consistent size and screen position using a new viewport matrix.

Once we have created all three of our HUD classes, we will add all of the object declarations, initializations, and drawing code.

Adding control buttons

The first HUD object we will make a class for, is a simple button.


I am showing all the imports explicitly, as they do not get imported automatically. Note ...

Get Android Game Programming: A Developer’s Guide 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.