Abstracting the UI
In the previous example, we looked at the basics of creating a frame-by-frame animation. We looked how we can use the class CADisplayLink
in conjunction with the existing event loop to call a task where we can implement our animation. We animated a single image around the screen based on user input. This was a very simple example. I left out a number of practical considerations so we could focus on the basic idea of creating animations in this way. In this section, we will do a little refactoring in order to better support more complicated games. Figure 5–7 shows the example we will be building.
Get Beginning iOS 5 Games Development: Using the iOS 5 SDK for iPad, iPhone, and iPod Touch 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.