mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-13 05:11:01 +00:00
Fix refresh rate on mode change
This commit is contained in:
parent
6a7b43aa2e
commit
ea30cfd8f8
1 changed files with 23 additions and 21 deletions
|
@ -1623,6 +1623,27 @@ void VID_PrepareModeList(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static UINT32 refresh_rate;
|
||||||
|
static UINT32 VID_GetRefreshRate(void)
|
||||||
|
{
|
||||||
|
int index = SDL_GetWindowDisplayIndex(window);
|
||||||
|
SDL_DisplayMode m;
|
||||||
|
|
||||||
|
if (SDL_WasInit(SDL_INIT_VIDEO) == 0)
|
||||||
|
{
|
||||||
|
// Video not init yet.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (SDL_GetCurrentDisplayMode(index, &m) != 0)
|
||||||
|
{
|
||||||
|
// Error has occurred.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m.refresh_rate;
|
||||||
|
}
|
||||||
|
|
||||||
INT32 VID_SetMode(INT32 modeNum)
|
INT32 VID_SetMode(INT32 modeNum)
|
||||||
{
|
{
|
||||||
SDLdoUngrabMouse();
|
SDLdoUngrabMouse();
|
||||||
|
@ -1667,30 +1688,11 @@ INT32 VID_SetMode(INT32 modeNum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refresh_rate = VID_GetRefreshRate();
|
||||||
|
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT32 refresh_rate;
|
|
||||||
static UINT32 VID_GetRefreshRate(void)
|
|
||||||
{
|
|
||||||
int index = SDL_GetWindowDisplayIndex(window);
|
|
||||||
SDL_DisplayMode m;
|
|
||||||
|
|
||||||
if (SDL_WasInit(SDL_INIT_VIDEO) == 0)
|
|
||||||
{
|
|
||||||
// Video not init yet.
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SDL_GetCurrentDisplayMode(index, &m) != 0)
|
|
||||||
{
|
|
||||||
// Error has occurred.
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return m.refresh_rate;
|
|
||||||
}
|
|
||||||
|
|
||||||
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
static SDL_bool Impl_CreateWindow(SDL_bool fullscreen)
|
||||||
{
|
{
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
Loading…
Reference in a new issue