Update to SDL 3.1.1 API.

Changes are:
* SDL_SetWindowGrab() was renamed to SDL_SetWindowMouseGrab().
* SDL doesn't give precalculated battery states anymore. Use the same
  scale as SDL 3.1.0, 20% is low and 1% is empty.
This commit is contained in:
Yamagi 2024-04-02 18:22:58 +02:00
parent af82cfe978
commit a675b654c6
2 changed files with 3 additions and 3 deletions

View File

@ -887,11 +887,11 @@ IN_Update(void)
{ {
break; break;
} }
if (event.jbattery.level == SDL_JOYSTICK_POWER_LOW) if (event.jbattery.percent <= 20)
{ {
Com_Printf("WARNING: Gamepad battery Low, it is recommended to connect it by cable.\n"); Com_Printf("WARNING: Gamepad battery Low, it is recommended to connect it by cable.\n");
} }
else if (event.jbattery.level == SDL_JOYSTICK_POWER_EMPTY) else if (event.jbattery.percent <= 1)
{ {
SCR_CenterPrint("ALERT: Gamepad battery almost Empty.\n"); SCR_CenterPrint("ALERT: Gamepad battery almost Empty.\n");
} }

View File

@ -779,7 +779,7 @@ GLimp_GrabInput(qboolean grab)
{ {
if(window != NULL) if(window != NULL)
{ {
SDL_SetWindowGrab(window, grab ? SDL_TRUE : SDL_FALSE); SDL_SetWindowMouseGrab(window, grab ? SDL_TRUE : SDL_FALSE);
} }
if(SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE) < 0) if(SDL_SetRelativeMouseMode(grab ? SDL_TRUE : SDL_FALSE) < 0)