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.
Note
I am showing all the imports explicitly, as they do not get imported automatically. Note that the next two classes will need these as well. The code is all in the download bundle as usual, if you wish to just copy and paste it.
Create a new class and call it GameButton
, then add the following import statements. Be sure to state the correct...