mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-04 01:41:56 +00:00
SDL joystick events now work while in menus
- DirectInput axes are now X first, Y second. - Menu axes controls swapped/fixed. - Added SDL DualShock3 buttons in menu actions. - Fixed SDL mouse system cursor; it could appear in-game. # Conflicts: # src/common/console/keydef.h # Conflicts: # src/win32/i_dijoy.cpp
This commit is contained in:
parent
85a3cef7fd
commit
6a10a4b84c
5 changed files with 17 additions and 13 deletions
|
@ -184,6 +184,8 @@ enum ESkillLevels
|
|||
#define KEY_JOY6 (KEY_FIRSTJOYBUTTON+5)
|
||||
#define KEY_JOY7 (KEY_FIRSTJOYBUTTON+6)
|
||||
#define KEY_JOY8 (KEY_FIRSTJOYBUTTON+7)
|
||||
#define KEY_JOY14 (KEY_FIRSTJOYBUTTON+13)
|
||||
#define KEY_JOY15 (KEY_FIRSTJOYBUTTON+14)
|
||||
#define KEY_LASTJOYBUTTON 0x187
|
||||
#define KEY_JOYPOV1_UP 0x188
|
||||
#define KEY_JOYPOV1_RIGHT 0x189
|
||||
|
|
|
@ -662,16 +662,19 @@ bool M_Responder (event_t *ev)
|
|||
switch (ch)
|
||||
{
|
||||
case KEY_JOY1:
|
||||
case KEY_JOY3:
|
||||
case KEY_JOY15:
|
||||
case KEY_PAD_A:
|
||||
mkey = MKEY_Enter;
|
||||
break;
|
||||
|
||||
case KEY_JOY2:
|
||||
case KEY_JOY14:
|
||||
case KEY_PAD_B:
|
||||
mkey = MKEY_Back;
|
||||
break;
|
||||
|
||||
case KEY_JOY3:
|
||||
case KEY_JOY4:
|
||||
case KEY_PAD_X:
|
||||
mkey = MKEY_Clear;
|
||||
break;
|
||||
|
@ -688,28 +691,28 @@ bool M_Responder (event_t *ev)
|
|||
|
||||
case KEY_PAD_DPAD_UP:
|
||||
case KEY_PAD_LTHUMB_UP:
|
||||
case KEY_JOYAXIS1MINUS:
|
||||
case KEY_JOYAXIS2MINUS:
|
||||
case KEY_JOYPOV1_UP:
|
||||
mkey = MKEY_Up;
|
||||
break;
|
||||
|
||||
case KEY_PAD_DPAD_DOWN:
|
||||
case KEY_PAD_LTHUMB_DOWN:
|
||||
case KEY_JOYAXIS1PLUS:
|
||||
case KEY_JOYAXIS2PLUS:
|
||||
case KEY_JOYPOV1_DOWN:
|
||||
mkey = MKEY_Down;
|
||||
break;
|
||||
|
||||
case KEY_PAD_DPAD_LEFT:
|
||||
case KEY_PAD_LTHUMB_LEFT:
|
||||
case KEY_JOYAXIS2MINUS:
|
||||
case KEY_JOYAXIS1MINUS:
|
||||
case KEY_JOYPOV1_LEFT:
|
||||
mkey = MKEY_Left;
|
||||
break;
|
||||
|
||||
case KEY_PAD_DPAD_RIGHT:
|
||||
case KEY_PAD_LTHUMB_RIGHT:
|
||||
case KEY_JOYAXIS2PLUS:
|
||||
case KEY_JOYAXIS1PLUS:
|
||||
case KEY_JOYPOV1_RIGHT:
|
||||
mkey = MKEY_Right;
|
||||
break;
|
||||
|
|
|
@ -52,6 +52,7 @@ bool I_SetCursor(FTexture *cursorpic)
|
|||
return false;
|
||||
}
|
||||
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
if (cursorSurface == NULL)
|
||||
cursorSurface = SDL_CreateRGBSurface (0, 32, 32, 32, MAKEARGB(0,255,0,0), MAKEARGB(0,0,255,0), MAKEARGB(0,0,0,255), MAKEARGB(255,0,0,0));
|
||||
|
||||
|
@ -67,6 +68,7 @@ bool I_SetCursor(FTexture *cursorpic)
|
|||
SDL_FreeCursor (cursor);
|
||||
cursor = SDL_CreateColorCursor (cursorSurface, 0, 0);
|
||||
SDL_SetCursor (cursor);
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -548,13 +548,10 @@ void MessagePump (const SDL_Event &sev)
|
|||
|
||||
case SDL_JOYBUTTONDOWN:
|
||||
case SDL_JOYBUTTONUP:
|
||||
if (!GUICapture)
|
||||
{
|
||||
event.type = sev.type == SDL_JOYBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
||||
event.data1 = KEY_FIRSTJOYBUTTON + sev.jbutton.button;
|
||||
if(event.data1 != 0)
|
||||
D_PostEvent(&event);
|
||||
}
|
||||
event.type = sev.type == SDL_JOYBUTTONDOWN ? EV_KeyDown : EV_KeyUp;
|
||||
event.data1 = KEY_FIRSTJOYBUTTON + sev.jbutton.button;
|
||||
if(event.data1 != 0)
|
||||
D_PostEvent(&event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -498,7 +498,7 @@ void FDInputJoystick::ProcessInput(unsigned int joynum)
|
|||
{
|
||||
// Since we sorted the axes, we know that the first two are definitely X and Y.
|
||||
// They are probably a single stick, so use angular position to determine buttons.
|
||||
buttonstate = Joy_XYAxesToButtons(axisval, Axes[0].Value);
|
||||
buttonstate = Joy_XYAxesToButtons(Axes[0].Value, axisval);
|
||||
Joy_GenerateButtonEvents(info->ButtonValue, buttonstate, 4, keyjoynaxis1plus);
|
||||
}
|
||||
info->ButtonValue = buttonstate;
|
||||
|
|
Loading…
Reference in a new issue