I have created a basic GLKit application in Objective C (using Xcode), using a barebones setup I got from here: http://games.ianterrell.com/2d-game-engine-tutorial/ .
I want to make my application interactive, by receiving touch data from the screen.
I don’t have an xib file, and from my limited understanding of this, I have to somehow create a UIView, hook it up to everything I’ve already created, then possibly overload the touches began function (getting the input in a UITouch object, then passing it around the application).
Does anyone know how this can be done?
You need to look into gesture recognizers, please check out the documentation for
UIGestureRecognizer: http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIGestureRecognizer_Class/Reference/Reference.htmlThis example can be used for a pinch gesture on your view:
Now you must implement a method called
handlePinch:(this is you who defines what this method is called), you define this method as follows:Other gestures you can use like this “out of the box” are: