kewl
OP
Created
Sep ’15
Replies
9
Boosts
0
Views
2.5k
Participants
3
The focus engine only supports UIViews and will not work on SKNodes. For presses and touches you'll want to look at implementing the -touchesBegan:/-pressesBegan methods.
@mwhuss, thank you for your reply. touchesmoved detects my buttons.. How do I make it in a way that each swipe it will jump to the next button ?
This is because the TV area is really big and my button is small.. so I have to keep touching to find the button.
You'll want to keep track of the "focused" sprite yourself and then try using a UISwipeGestureRecognizer to move it.
The DemoBots sample app does this, and does it by using mapping GameController inputs to changes in focus itself. The neat thing about this is that even other paired controllers also work in addition to the AppleTV remote. But, it's all done without the Focus engine.
@mwhuss thank you for your reply.
Once I implement UISwipeGestureRecognizer, will it also support 3rd Party Game Controller ?
@ljdickey, thank you for your reply. are you referring to BaseScene.swift? controlInputSource function?
Yes, BaseScene handles enforcing what sprites represent buttons and which should get the next focus. Also, GameViewController inherits from GCEventViewController and uses the controllerUserInteractionEnabled property to control whether or not you want to get game-like events or UIEvent-type events -- it uses the UIEvent model for the home and end screens, where there are buttons shown, and game-like events when actually playing the game.
hi @mwhuss i tried to use pressedBegan in GameScene, however it does not detect when I press menu button on apple TV remote. What's the correct way of doing this ?
-(void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event{
NSLog(@"test on pressed Began");
}
Is -userInteractionEnabled YES on the GameScene?