Skip to content

Commit

Permalink
Add SetWindowMonitor
Browse files Browse the repository at this point in the history
NOTE: The function is implemented but incomplete
  • Loading branch information
Bigfoot71 authored Oct 18, 2023
1 parent dafe42c commit db0674c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/rcore_desktop_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,20 @@ void SetWindowPosition(int x, int y)
// Set monitor for the current window
void SetWindowMonitor(int monitor)
{
TRACELOG(LOG_WARNING, "SetWindowMonitor() not available on target platform");
if (monitor < 0 || monitor >= SDL_GetNumVideoDisplays())
{
TRACELOG(LOG_ERROR, "Invalid monitor index");
return;
}

SDL_Rect displayBounds;
if (SDL_GetDisplayBounds(monitor, &displayBounds) != 0)
{
TRACELOG(LOG_ERROR, "Failed to get display bounds");
return;
}

SDL_SetWindowPosition(platform.window, displayBounds.x, displayBounds.y);
}

// Set window minimum dimensions (FLAG_WINDOW_RESIZABLE)
Expand Down

0 comments on commit db0674c

Please sign in to comment.