Fixed building with --disable-joystick on iOS

This commit is contained in:
Sam Lantinga 2020-05-27 10:27:20 -07:00
parent cf01ee1694
commit 57149c2410
1 changed files with 6 additions and 0 deletions

View File

@ -37,7 +37,9 @@
#define MAX_MOUSE_BUTTONS 5 #define MAX_MOUSE_BUTTONS 5
/* This is defined in SDL_sysjoystick.m */ /* This is defined in SDL_sysjoystick.m */
#if !SDL_JOYSTICK_DISABLED
extern int SDL_AppleTVRemoteOpenedAsJoystick; extern int SDL_AppleTVRemoteOpenedAsJoystick;
#endif
@implementation SDL_uikitview { @implementation SDL_uikitview {
SDL_Window *sdlwindow; SDL_Window *sdlwindow;
@ -374,6 +376,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
} }
#endif #endif
#if !SDL_JOYSTICK_DISABLED
/* Presses from Apple TV remote */ /* Presses from Apple TV remote */
if (!SDL_AppleTVRemoteOpenedAsJoystick) { if (!SDL_AppleTVRemoteOpenedAsJoystick) {
switch (press.type) { switch (press.type) {
@ -398,6 +401,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
break; break;
} }
} }
#endif /* !SDL_JOYSTICK_DISABLED */
return SDL_SCANCODE_UNKNOWN; return SDL_SCANCODE_UNKNOWN;
} }
@ -465,6 +469,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
{ {
/* Swipe gestures don't trigger begin states. */ /* Swipe gestures don't trigger begin states. */
if (gesture.state == UIGestureRecognizerStateEnded) { if (gesture.state == UIGestureRecognizerStateEnded) {
#if !SDL_JOYSTICK_DISABLED
if (!SDL_AppleTVRemoteOpenedAsJoystick) { if (!SDL_AppleTVRemoteOpenedAsJoystick) {
/* Send arrow key presses for now, as we don't have an external API /* Send arrow key presses for now, as we don't have an external API
* which better maps to swipe gestures. */ * which better maps to swipe gestures. */
@ -483,6 +488,7 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
break; break;
} }
} }
#endif /* !SDL_JOYSTICK_DISABLED */
} }
} }
#endif /* TARGET_OS_TV */ #endif /* TARGET_OS_TV */