Hi,
when I implemented the navigation for my level selection screen (5 rows with 5 levels each) I used the swipe controls on the tv remote:
With the up / down / left / right swipes you can navigate to the level of your choice.
Now when I test on the Apple tv using the real remote I get multiple keys for each swipe gesture.
Take this code for testing:
local appPurpose = display.newText( "Apple tv remote key tester", 160, 64, native.systemFontBold, 18 ) local function onKey( event ) local phase = event.phase local keyName = event.keyName if phase == "down" then print( "keyName: ", keyName ) end return true end Runtime:addEventListener( "key", onKey )
Just run the program on the Apple tv and I get the following output in Xcode:
When I swipe DOWN:
Dec 6 23:19:56 Apple-TV KeyTest[180] <Warning>: keyName: right
Dec 6 23:19:56 Apple-TV KeyTest[180] <Warning>: keyName: down
or
Dec 6 23:22:28 Apple-TV KeyTest[180] <Warning>: keyName: left
Dec 6 23:22:28 Apple-TV KeyTest[180] <Warning>: keyName: down
or
Dec 6 23:21:45 Apple-TV KeyTest[180] <Warning>: keyName: right
Dec 6 23:21:45 Apple-TV KeyTest[180] <Warning>: keyName: down
Dec 6 23:21:45 Apple-TV KeyTest[180] <Warning>: keyName: left
The same happens with the other directions.
It looks as if the swipe gesture down creates multiple key events:
One event for the direction I was swiping, “down”, as show as the second event that happened.
And one event for the second direction the swipe was heading to - you will never swipe exactly down, there always will be some deviation to the left or right, and this is send as another key event.
If this would be always the case I could live with it, I would always take the second event.
But sometimes even three key events happen, as shown above.
I attached the test project with build and config files.
Thanks & best
Andreas