We have an interface in Scaleform and therefore can't use built-in classes such as UIButton, UITextField, etc.
This is what I've tried so far:
Handling swipes via UISwipeGestureRecognizer, but unlike Focus system it produces only one event while finger touches the touchpad area.
Subscribing to GCMicroGamepad.dpad.ValueChangedHandler
GCMicroGamepad.reportsAbsoluteDpadValues is to YES, since absoluteValues are needed for gameplay purposes.
I assumed that i could figure out the relative values easily. But it turned out that when I press the corner of touchpad, get following updates:
(x = 1, y = 0)
(x = 1, y = 1)
instead of simply recieving
(x = 1, y = 1)
That means that there are two valueChanged events generated instead of one.
Is there any way to subscribe to Focus engine events?
Ok, I have acheived it that way:
I have an update loop(obviously). In this update loop I look at CurTouchpadPosition and PrevTouchpadPosition.
CurTouchpadPosition is set during every call of GCMicroGamepad.dpad.ValueChangedHandler
And PrevTouchpadPosition is set to CurTouchpadPosition after the Update finishes.
Obviously this can introduce some issues if the calls come in following sequence:
GCMicroGamepad.dpad.ValueChangedHandler(x = 0, y = 1)
Update()
GCMicroGamepad.dpad.ValueChangedHandler(x = 1, y = 1)
But that doesn't really happen. Probabaly GCMicroGamepad.dpad.ValueChangedHandler is called somewhere in the main thread.