To note, this: tvOS Menu button with GameController API is still a problem on tvOS with 2.0.10. Just me experiencing this?
There is also a bug report here: https://bugzilla.libsdl.org/show_bug.cgi?id=4531
I’ll try and find what caused it sometime soonish.
EDIT: I’ve fixed most of the problems using some hints and by ignoring remotes with only a few buttons (not opening them.) For Menu to return to the OS from the toplevel of the game, I needed this patch:
diff -ur SDL2-2.0.10/src/video/uikit/SDL_uikitview.m SDL2-2.0.10-goob/src/video/uikit/SDL_uikitview.m
--- SDL2-2.0.10/src/video/uikit/SDL_uikitview.m 2019-07-28 20:26:20.000000000 -0600
+++ SDL2-2.0.10-goob/src/video/uikit/SDL_uikitview.m 2019-07-28 20:25:34.000000000 -0600
@@ -261,7 +261,7 @@
return SDL_SCANCODE_RETURN;
case UIPressTypeMenu:
/* HIG says: "returns to previous screen" */
- return SDL_SCANCODE_ESCAPE;
+ return SDL_SCANCODE_MENU;
case UIPressTypePlayPause:
/* HIG says: "secondary button behavior" */
return SDL_SCANCODE_PAUSE;
For some reason Menu was changed to Escape which makes it impossible to exit to the OS which I believe is part of Apple’s requirements of tvOS apps. For the record, I use this code in my event filter to handle the Menu button properly (I set pass_menu_to_os on the title screen to true.)
case SDL_APP_DIDENTERFOREGROUND:
SDL_SetHint(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, "0");
return 0;
case SDL_KEYDOWN:
case SDL_KEYUP:
if (event->key.keysym.sym == SDLK_MENU && pass_menu_to_os) {
SDL_SetHint(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, "1");
}
return 1;