diff --git a/global.h b/global.h index dada5e90..89b3eb00 100644 --- a/global.h +++ b/global.h @@ -984,6 +984,27 @@ GFX2_GLOBAL SDL_Joystick* Joystick; /// It was chosen to not conflict with any SDL key number. #define KEY_JOYBUTTON (SDLK_LAST+4) +/// Button definitions for the gp2x +#define GP2X_BUTTON_UP (0) +#define GP2X_BUTTON_DOWN (4) +#define GP2X_BUTTON_LEFT (2) +#define GP2X_BUTTON_RIGHT (6) +#define GP2X_BUTTON_UPLEFT (1) +#define GP2X_BUTTON_UPRIGHT (7) +#define GP2X_BUTTON_DOWNLEFT (3) +#define GP2X_BUTTON_DOWNRIGHT (5) +#define GP2X_BUTTON_CLICK (18) +#define GP2X_BUTTON_A (12) +#define GP2X_BUTTON_B (13) +#define GP2X_BUTTON_Y (14) +#define GP2X_BUTTON_X (15) +#define GP2X_BUTTON_L (10) +#define GP2X_BUTTON_R (11) +#define GP2X_BUTTON_START (8) +#define GP2X_BUTTON_SELECT (9) +#define GP2X_BUTTON_VOLUP (16) +#define GP2X_BUTTON_VOLDOWN (17) + #ifdef __gp2x__ #define KEY_ESC (KEY_JOYBUTTON+GP2X_BUTTON_X) #else diff --git a/input.c b/input.c index 51775ce2..176696b6 100644 --- a/input.c +++ b/input.c @@ -443,7 +443,7 @@ int Handle_joystick_press(SDL_JoyButtonEvent event) Input_new_mouse_K=2; return Move_cursor_with_constraints(); } - #ifdef __gp2x__ + #ifdef __GP2X__ switch(event.button) { #ifndef NO_JOYCURSOR @@ -503,7 +503,7 @@ int Handle_joystick_release(SDL_JoyButtonEvent event) return Release_control(0,MOD_ALT); } - #ifdef __gp2x__ + #ifdef __GP2X__ switch(event.button) { case GP2X_BUTTON_UP: diff --git a/keyboard.c b/keyboard.c index cdeed756..05c06702 100644 --- a/keyboard.c +++ b/keyboard.c @@ -465,7 +465,7 @@ const char * Key_name(word Key) if (Key>=KEY_JOYBUTTON && Key<=KEY_JOYBUTTON+18) { -#ifdef __gp2x__ +#ifdef __GP2X__ char *button_name; switch(Key)