Hour 8. Bringing Your Game to Life with Looping

What You’ll Learn in This Hour

• How to create a threaded game loop

• Using the Runnable interface

• Using the Thread class

• Drawing from the new game loop

This hour shows how to create a loop for a game that gives it real-time capabilities not tied in to the GUI methods (such as onDraw()) for the game’s display. To detach drawing from the GUI, you learn how to create components that can draw without being directly tied to the onDraw() event method. While exploring this new capability, you also get a glimpse at bitmap frame animation, bitmap scaling, and timing.

Creating a Threaded Game Loop

In the past few hours you have seen several examples that draw shapes and bitmaps to the Android screen. ...

Get Sams Teach Yourself Android Game Programming in 24 Hours 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.