Performing gestures

Gestures can act as functional input shortcuts. Simple gestures like swiping and scrolling are built into many Apple UI tools. Some games, notably Castlevania: Dawn of Sorrow (DS) and Okami (PS2, Wii) use gestures as core gameplay mechanics. In this recipe, we will implement a simple and admittedly crude gesture system.

Performing gestures

Getting ready

Please refer to the project RecipeCollection01 for full working code of this recipe. Also note that the GestureLine and GestureShapeLayer classes have been omitted for brevity. GestureLine simply contains two CGPoint structures. GestureShapeLayer draws a circle or an array of lines.

How to do it... ...

Get Cocos2d for iPhone 1 Game Development Cookbook now with O’Reilly online learning.

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