projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added clearing joystick state to 'clear all input actions' event function
[rocksndiamonds.git]
/
src
/
events.c
diff --git
a/src/events.c
b/src/events.c
index 2472fdf5f8978b048af638730299206544445255..8ddf4e9b87e6704dac106abc5f7004dccb75022d 100644
(file)
--- a/
src/events.c
+++ b/
src/events.c
@@
-250,7
+250,11
@@
void HandleOtherEvents(Event *event)
#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONDOWN:
case SDL_CONTROLLERBUTTONUP:
#if defined(TARGET_SDL2)
case SDL_CONTROLLERBUTTONDOWN:
case SDL_CONTROLLERBUTTONUP:
+ // for any game controller button event, disable overlay buttons
+ SetOverlayEnabled(FALSE);
+
HandleSpecialGameControllerButtons(event);
HandleSpecialGameControllerButtons(event);
+
/* FALL THROUGH */
case SDL_CONTROLLERDEVICEADDED:
case SDL_CONTROLLERDEVICEREMOVED:
/* FALL THROUGH */
case SDL_CONTROLLERDEVICEADDED:
case SDL_CONTROLLERDEVICEREMOVED:
@@
-374,6
+378,8
@@
void ClearPlayerAction()
key_joystick_mapping = 0;
for (i = 0; i < MAX_PLAYERS; i++)
stored_player[i].action = 0;
key_joystick_mapping = 0;
for (i = 0; i < MAX_PLAYERS; i++)
stored_player[i].action = 0;
+
+ ClearJoystickState();
}
void SleepWhileUnmapped()
}
void SleepWhileUnmapped()
@@
-668,6
+674,9
@@
void HandleFingerEvent(FingerEvent *event)
"KEY_PRESSED");
int i;
"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);
Error(ERR_DEBUG, "::: key '%s' was '%s' [fingerId: %lld]",
getKeyNameFromKey(key), key_status_name, event->fingerId);
@@
-1148,9
+1157,16
@@
void HandleKeyEvent(KeyEvent *event)
#endif
#if defined(PLATFORM_ANDROID)
#endif
#if defined(PLATFORM_ANDROID)
- // always map the "back" button to the "escape" key on Android devices
if (key == KSYM_Back)
if (key == KSYM_Back)
+ {
+ // always map the "back" button to the "escape" key on Android devices
key = KSYM_Escape;
key = KSYM_Escape;
+ }
+ else
+ {
+ // for any key event other than "back" button, disable overlay buttons
+ SetOverlayEnabled(FALSE);
+ }
#endif
HandleKeyModState(keymod, key_status);
#endif
HandleKeyModState(keymod, key_status);
@@
-1526,9
+1542,11
@@
void HandleKey(Key key, int key_status)
int i;
#if defined(TARGET_SDL2)
int i;
#if defined(TARGET_SDL2)
- /* map special
"play/pause" media key to default key for play/pause action
s */
+ /* map special
keys (media keys / remote control buttons) to default key
s */
if (key == KSYM_PlayPause)
key = KSYM_space;
if (key == KSYM_PlayPause)
key = KSYM_space;
+ else if (key == KSYM_Select)
+ key = KSYM_Return;
#endif
HandleSpecialGameControllerKeys(key, key_status);
#endif
HandleSpecialGameControllerKeys(key, key_status);