#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONDOWN:
case SDL_CONTROLLERBUTTONUP:
+ // for any game controller button event, disable overlay buttons
+ SetOverlayEnabled(FALSE);
+
HandleSpecialGameControllerButtons(event);
+
/* FALL THROUGH */
case SDL_CONTROLLERDEVICEADDED:
case SDL_CONTROLLERDEVICEREMOVED:
"KEY_PRESSED");
int i;
+ // for any touch input event, enable overlay buttons (if activated)
+ SetOverlayEnabled(TRUE);
+
Error(ERR_DEBUG, "::: key '%s' was '%s' [fingerId: %lld]",
getKeyNameFromKey(key), key_status_name, event->fingerId);
#endif
#if defined(PLATFORM_ANDROID)
- // always map the "back" button to the "escape" key on Android devices
if (key == KSYM_Back)
+ {
+ // always map the "back" button to the "escape" key on Android devices
key = KSYM_Escape;
+ }
+ else
+ {
+ // for any key event other than "back" button, disable overlay buttons
+ SetOverlayEnabled(FALSE);
+ }
#endif
HandleKeyModState(keymod, key_status);
static int alpha_step = 5;
static int alpha_last = 0;
static int alpha = 0;
+ boolean active = (overlay.enabled && overlay.active);
- if (!overlay.active && deactivated)
+ if (!active && deactivated)
return;
- if (overlay.active)
+ if (active)
{
if (alpha < alpha_max)
alpha = MIN(alpha + alpha_step, alpha_max);
void InitOverlayInfo()
{
+ overlay.enabled = FALSE;
overlay.active = FALSE;
+
+#if defined(PLATFORM_ANDROID)
+ if (strEqual(setup.touch.control_type, TOUCH_CONTROL_VIRTUAL_BUTTONS))
+ overlay.enabled = TRUE;
+#endif
+}
+
+void SetOverlayEnabled(boolean enabled)
+{
+ overlay.enabled = enabled;
}
void SetOverlayActive(boolean active)
struct OverlayInfo
{
- boolean active;
+ boolean enabled; /* overlay generally enabled or disabled */
+ boolean active; /* overlay activated (depending on game mode) */
};
struct JoystickInfo
void InitGfxCustomArtworkInfo();
void InitGfxOtherSettings();
void InitOverlayInfo();
+void SetOverlayEnabled(boolean);
void SetOverlayActive(boolean);
boolean GetOverlayActive();
void SetDrawDeactivationMask(int);