O'Reilly logo

Learning AndEngine by Martin Varga

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

HUD

To understand how heads-up display works, simply imagine that we draw something on a piece of glass and put this glass in front of a camera in a way that whenever the camera moves, the glass moves with it. This is exactly what we need to display the score.

AndEngine has a concept of camera scene, a scene that works as the glass. HUD is a special camera scene that has no background, so it is always see-through.

Have a look at the following illustration of how the HUD works. The black rectangle defines the visible portion of the scene. The HUD is the translucent rectangle. The resulting image has the text in the top-left corner. Even if the visible portion of the scene changes because of camera movement, the text will stay in the corner.

Another ...

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