mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
don't send ev_joystick and ev_mouse if menu is open (#1460)
This commit is contained in:
parent
f3c4e29e9a
commit
f3b9f69ba5
@ -98,14 +98,31 @@ void I_UpdateJoystick(boolean axis_buttons)
|
||||
if (axis_buttons)
|
||||
{
|
||||
AxisToButtons(&ev);
|
||||
ev.type = ev_joystick_state;
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
|
||||
ev.type = ev_joystick;
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
|
||||
void I_UpdateJoystickMenu(void)
|
||||
{
|
||||
static event_t ev;
|
||||
|
||||
if (controller == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ev.data1 = GetAxisState(SDL_CONTROLLER_AXIS_LEFTX);
|
||||
ev.data2 = GetAxisState(SDL_CONTROLLER_AXIS_LEFTY);
|
||||
ev.data3 = GetAxisState(SDL_CONTROLLER_AXIS_RIGHTX);
|
||||
ev.data4 = GetAxisState(SDL_CONTROLLER_AXIS_RIGHTY);
|
||||
|
||||
AxisToButtons(&ev);
|
||||
ev.type = ev_joystick_state;
|
||||
D_PostEvent(&ev);
|
||||
}
|
||||
|
||||
static void UpdateJoystickButtonState(unsigned int button, boolean on)
|
||||
{
|
||||
static event_t event;
|
||||
|
@ -26,6 +26,7 @@ void I_CloseController(int which);
|
||||
double I_AccelerateMouse(int val);
|
||||
void I_ReadMouse(void);
|
||||
void I_UpdateJoystick(boolean axis_buttons);
|
||||
void I_UpdateJoystickMenu(void);
|
||||
|
||||
void I_DelayEvent(void);
|
||||
void I_HandleJoystickEvent(SDL_Event *sdlevent);
|
||||
|
@ -196,7 +196,15 @@ void I_ShowMouseCursor(boolean on)
|
||||
state = on;
|
||||
}
|
||||
|
||||
SDL_ShowCursor(on ? SDL_ENABLE : SDL_DISABLE);
|
||||
if (on)
|
||||
{
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
SDL_GetRelativeMouseState(NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// [FG] window event handling from Chocolate Doom 3.0
|
||||
@ -458,18 +466,13 @@ void I_StartTic (void)
|
||||
{
|
||||
I_GetEvent();
|
||||
|
||||
if (window_focused)
|
||||
{
|
||||
I_ReadMouse();
|
||||
}
|
||||
|
||||
if (I_UseController())
|
||||
{
|
||||
I_UpdateJoystick(true);
|
||||
}
|
||||
|
||||
if (menuactive)
|
||||
{
|
||||
if (I_UseController())
|
||||
{
|
||||
I_UpdateJoystickMenu();
|
||||
}
|
||||
|
||||
static event_t ev;
|
||||
static int oldx, oldy;
|
||||
static SDL_Rect old_rect;
|
||||
@ -515,6 +518,17 @@ void I_StartTic (void)
|
||||
ev.data3 = y;
|
||||
|
||||
D_PostEvent(&ev);
|
||||
return;
|
||||
}
|
||||
|
||||
if (window_focused)
|
||||
{
|
||||
I_ReadMouse();
|
||||
}
|
||||
|
||||
if (I_UseController())
|
||||
{
|
||||
I_UpdateJoystick(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user