1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-12-19 12:28:07 +00:00

JOY_ID constant

This commit is contained in:
Zeno Rogue
2025-12-12 09:55:28 +01:00
parent a0c8fbe07b
commit 836d341d40
2 changed files with 3 additions and 2 deletions

View File

@@ -805,7 +805,7 @@ EX bool is_joy_any(int sym) {
} }
EX bool is_joy_index(int sym, int index) { EX bool is_joy_index(int sym, int index) {
return is_joy_any(sym) && (sym & 127) == index; return is_joy_any(sym) && (sym & (JOY_ID - 1)) == index;
} }
#if HDR #if HDR
@@ -1227,7 +1227,7 @@ EX void handle_event(SDL_Event& ev) {
} }
else if(ev.type == SDL_EVENT_JOYSTICK_BUTTON_DOWN && defaultjoy) { else if(ev.type == SDL_EVENT_JOYSTICK_BUTTON_DOWN && defaultjoy) {
sym = uni = PSEUDOKEY_JOY + 128 * ev.jbutton.which + ev.jbutton.button; sym = uni = PSEUDOKEY_JOY + JOY_ID * ev.jbutton.which + ev.jbutton.button;
} }
#endif #endif

View File

@@ -252,6 +252,7 @@
#define PSEUDOKEY_ONSCREEN_KEYBOARD 2509 #define PSEUDOKEY_ONSCREEN_KEYBOARD 2509
#define PSEUDOKEY_JOY 4096 #define PSEUDOKEY_JOY 4096
#define JOY_ID 128
#ifndef CAP_PNG #ifndef CAP_PNG
#define CAP_PNG (!ISMOBWEB) #define CAP_PNG (!ISMOBWEB)