Chapter 8

2D Game Programming Tricks

Chapter 7 demonstrated that OpenGL ES offers quite a lot of features to exploit for 2D graphics programming, such as easy rotation and scaling and the automatic stretching of your view frustum to the viewport. It also offers performance benefits over using the Canvas.

Now it’s time to look at some of the more advanced topics of 2D game programming. You used some of these concepts intuitively when you wrote Mr. Nom, including time-based state updates and image atlases. A lot of what’s to come is also indeed very intuitive, and chances are high that you’d have come up with the same solution sooner or later. But it doesn’t hurt to learn about these things explicitly.

There are a handful of crucial concepts for ...

Get Beginning Android Games, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.