Game Development Reference
In-Depth Information
Figure 8-5. Rotating a spaceship with the rotation gesture
Listing 8-20. RotationGestureController.h
@interface RotationGestureController : GameController{
Viper* viper;
float startRotation;
}
-(void)rotationGesture:(UIRotationGestureRecognizer*)rotationRecognizer;
@end
In Listing 8-20, we see the header file for the class RotationGestureController . We see that
we have a reference to the spaceship, called Viper. We also keep track of the starting rotation
of the spaceship in the variable startRotation . The task rotationGesture : is called when a
UIRotationGestureRecognizer recognizes a gesture. Let's take a quick look at the doSetup task for
the class RotationGestureController so we understand how the UIRotationGestureRecognizer is
set up. See Listing 8-21.
 
Search WWH ::




Custom Search