Skip to content

Commit

Permalink
engine: platform: sdl: change behavior when window position is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
OlegAckbar authored and a1batross committed Feb 9, 2025
1 parent 546903e commit eda0ac9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion engine/platform/sdl/vid_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,16 @@ qboolean VID_CreateWindow( int width, int height, window_mode_t window_mode )
else
SetBits( wndFlags, SDL_WINDOW_FULLSCREEN_DESKTOP );
SetBits( wndFlags, SDL_WINDOW_BORDERLESS );
if ( window_xpos.value < 0 || window_ypos.value < 0 )
{
xpos = SDL_WINDOWPOS_UNDEFINED;
ypos = SDL_WINDOWPOS_UNDEFINED;
}
else
{
xpos = window_xpos.value;
ypos = window_ypos.value;
}
}

if( !VID_CreateWindowWithSafeGL( wndname, xpos, ypos, width, height, wndFlags ))
Expand Down Expand Up @@ -1048,7 +1056,8 @@ qboolean R_Init_Video( const int type )

#if SDL_VERSION_ATLEAST( 2, 0, 0 )
SDL_DisplayMode displayMode;
SDL_GetCurrentDisplayMode( 0, &displayMode );
SDL_Point point = { window_xpos.value, window_ypos.value };
SDL_GetCurrentDisplayMode( SDL_GetPointDisplayIndex( &point ), &displayMode );
refState.desktopBitsPixel = SDL_BITSPERPIXEL( displayMode.format );
#else
refState.desktopBitsPixel = 16;
Expand Down

0 comments on commit eda0ac9

Please sign in to comment.