From 105837bfb22eb34a7dde94bcbecc6e4f254f5cbc Mon Sep 17 00:00:00 2001 From: ubkp <118854183+ubkp@users.noreply.github.com> Date: Tue, 17 Oct 2023 00:11:26 -0300 Subject: [PATCH] Add missing implementations 5 --- src/rcore_desktop_sdl.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/rcore_desktop_sdl.c b/src/rcore_desktop_sdl.c index a39b28b5e..3cb754cd2 100644 --- a/src/rcore_desktop_sdl.c +++ b/src/rcore_desktop_sdl.c @@ -301,6 +301,9 @@ void SetWindowTitle(const char *title) void SetWindowPosition(int x, int y) { SDL_SetWindowPosition(platform.window, x, y); + + CORE.Window.position.x = x; + CORE.Window.position.y = y; } // Set monitor for the current window @@ -433,8 +436,20 @@ int GetMonitorPhysicalHeight(int monitor) // Get selected monitor refresh rate int GetMonitorRefreshRate(int monitor) { - TRACELOG(LOG_WARNING, "GetMonitorRefreshRate() not implemented on target platform"); - return 0; + int refresh = 0; + + int monitorCount = 0; + monitorCount = SDL_GetNumVideoDisplays(); + + if ((monitor >= 0) && (monitor < monitorCount)) + { + SDL_DisplayMode mode; + SDL_GetCurrentDisplayMode(monitor, &mode); + refresh = mode.refresh_rate; + } + else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor"); + + return refresh; } // Get the human-readable, UTF-8 encoded name of the selected monitor