O'Reilly logo

Android Game Programming by Example by John Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required