Skip to content

Commit

Permalink
Add GetMonitorPosition
Browse files Browse the repository at this point in the history
  • Loading branch information
Bigfoot71 authored Oct 18, 2023
1 parent aa66089 commit dafe42c
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/rcore_desktop_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,8 +647,20 @@ int GetCurrentMonitor(void)
// Get selected monitor position
Vector2 GetMonitorPosition(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorPosition() not implemented on target platform");
return (Vector2){ 0, 0 };
if (monitor < 0 || monitor >= SDL_GetNumVideoDisplays())
{
TRACELOG(LOG_ERROR, "Invalid monitor index");
return (Vector2) { 0, 0 };
}

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

return (Vector2) { displayBounds.x, displayBounds.y };
}

// Get selected monitor width (currently used by monitor)
Expand Down

0 comments on commit dafe42c

Please sign in to comment.