Skip to content

Commit

Permalink
Bump to SDL3 gitrev 8db3b47
Browse files Browse the repository at this point in the history
  • Loading branch information
erysdren authored and Yamagi committed Oct 6, 2024
1 parent 219b1b9 commit 39d2c7d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions src/client/input/sdl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ IN_Controller_Init(qboolean notify_user)
int nummappings;
char controllerdb[MAX_OSPATH] = {0};
SDL_Joystick *joystick = NULL;
SDL_bool is_controller = SDL_FALSE;
bool is_controller = false;

cvar = Cvar_Get("in_sdlbackbutton", "1", CVAR_ARCHIVE);
if (cvar)
Expand Down Expand Up @@ -2213,7 +2213,7 @@ IN_Controller_Init(qboolean notify_user)
#ifdef NATIVE_SDL_GYRO

if (SDL_GamepadHasSensor(controller, SDL_SENSOR_GYRO)
&& !SDL_SetGamepadSensorEnabled(controller, SDL_SENSOR_GYRO, SDL_TRUE) )
&& !SDL_SetGamepadSensorEnabled(controller, SDL_SENSOR_GYRO, true) )
{
show_gyro = true;
Com_Printf( "Gyro sensor enabled at %.2f Hz\n",
Expand All @@ -2224,7 +2224,7 @@ IN_Controller_Init(qboolean notify_user)
Com_Printf("Gyro sensor not found.\n");
}

SDL_bool hasLED = SDL_GetBooleanProperty(SDL_GetGamepadProperties(controller), SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, SDL_FALSE);
bool hasLED = SDL_GetBooleanProperty(SDL_GetGamepadProperties(controller), SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, false);
if (hasLED)
{
SDL_SetGamepadLED(controller, 0, 80, 0); // green light
Expand All @@ -2248,7 +2248,7 @@ IN_Controller_Init(qboolean notify_user)
show_haptic = true;
}

SDL_bool hasRumble = SDL_GetBooleanProperty(SDL_GetGamepadProperties(controller), SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, SDL_FALSE);
bool hasRumble = SDL_GetBooleanProperty(SDL_GetGamepadProperties(controller), SDL_PROP_GAMEPAD_CAP_RUMBLE_BOOLEAN, false);
if (hasRumble)
{
show_haptic = true;
Expand Down
4 changes: 2 additions & 2 deletions src/client/refresh/soft/sw_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2194,7 +2194,7 @@ RE_CleanFrame(void)
memset(swap_buffers, 0,
vid_buffer_height * vid_buffer_width * sizeof(pixel_t) * 2);

if (SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
if (!SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
{
Com_Printf("Can't lock texture: %s\n", SDL_GetError());
return;
Expand All @@ -2214,7 +2214,7 @@ RE_FlushFrame(int vmin, int vmax)
int pitch;
Uint32 *pixels;

if (SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
if (!SDL_LockTexture(texture, NULL, (void**)&pixels, &pitch))
{
Com_Printf("Can't lock texture: %s\n", SDL_GetError());
return;
Expand Down
16 changes: 8 additions & 8 deletions src/client/vid/glimp_sdl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ CreateSDLWindow(int flags, int fullscreen, int w, int h)
SDL_SetNumberProperty(props, "flags", flags);

if (flags & SDL_WINDOW_OPENGL)
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, SDL_TRUE);
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, true);

window = SDL_CreateWindowWithProperties(props);
SDL_DestroyProperties(props);
Expand Down Expand Up @@ -161,15 +161,15 @@ CreateSDLWindow(int flags, int fullscreen, int w, int h)
switch to it in exclusive fullscreen mode. */
SDL_DisplayMode closestMode;

if (SDL_GetClosestFullscreenDisplayMode(last_display, w, h, vid_rate->value, false, &closestMode) != SDL_TRUE)
if (SDL_GetClosestFullscreenDisplayMode(last_display, w, h, vid_rate->value, false, &closestMode) != true)
{
Com_Printf("SDL was unable to find a mode close to %ix%i@%f\n", w, h, vid_rate->value);

if (vid_rate->value != 0)
{
Com_Printf("Retrying with desktop refresh rate\n");

if (SDL_GetClosestFullscreenDisplayMode(last_display, w, h, vid_rate->value, false, &closestMode) == SDL_TRUE)
if (SDL_GetClosestFullscreenDisplayMode(last_display, w, h, vid_rate->value, false, &closestMode) == true)
{
Cvar_SetValue("vid_rate", 0);
}
Expand Down Expand Up @@ -509,15 +509,15 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
{
if (fullscreen == FULLSCREEN_EXCLUSIVE)
{
if (SDL_GetClosestFullscreenDisplayMode(last_display, width, height, vid_rate->value, false, &closestMode) != SDL_TRUE)
if (SDL_GetClosestFullscreenDisplayMode(last_display, width, height, vid_rate->value, false, &closestMode) != true)
{
Com_Printf("SDL was unable to find a mode close to %ix%i@%f\n", width, height, vid_rate->value);

if (vid_rate->value != 0)
{
Com_Printf("Retrying with desktop refresh rate\n");

if (SDL_GetClosestFullscreenDisplayMode(last_display, width, height, 0, false, &closestMode) == SDL_TRUE)
if (SDL_GetClosestFullscreenDisplayMode(last_display, width, height, 0, false, &closestMode) == true)
{
Cvar_SetValue("vid_rate", 0);
}
Expand Down Expand Up @@ -764,16 +764,16 @@ GLimp_GrabInput(qboolean grab)
{
if(window != NULL)
{
SDL_SetWindowMouseGrab(window, grab ? SDL_TRUE : SDL_FALSE);
SDL_SetWindowMouseGrab(window, grab ? true : false);
}

#ifdef USE_SDL3
if(!SDL_SetWindowRelativeMouseMode(window, grab ? SDL_TRUE : SDL_FALSE))
if(!SDL_SetWindowRelativeMouseMode(window, grab ? true : false))
{
Com_Printf("WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError());
}
#else
if(SDL_SetWindowRelativeMouseMode(window, grab ? SDL_TRUE : SDL_FALSE) < 0)
if(SDL_SetWindowRelativeMouseMode(window, grab ? true : false) < 0)
{
Com_Printf("WARNING: Setting Relative Mousemode failed, reason: %s\n", SDL_GetError());
Com_Printf(" You should probably update to SDL 2.0.3 or newer!\n");
Expand Down

0 comments on commit 39d2c7d

Please sign in to comment.