Complement GetMonitorPosition SDL implementation
This commit is contained in:
parent
c8e04b0af5
commit
e5b0d796e2
|
|
@ -693,20 +693,18 @@ int GetCurrentMonitor(void)
|
||||||
// Get selected monitor position
|
// Get selected monitor position
|
||||||
Vector2 GetMonitorPosition(int monitor)
|
Vector2 GetMonitorPosition(int monitor)
|
||||||
{
|
{
|
||||||
if (monitor < 0 || monitor >= SDL_GetNumVideoDisplays())
|
const int monitorCount = SDL_GetNumVideoDisplays();
|
||||||
|
if ((monitor >= 0) && (monitor < monitorCount))
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_ERROR, "Invalid monitor index");
|
|
||||||
return (Vector2) { 0, 0 };
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_Rect displayBounds;
|
SDL_Rect displayBounds;
|
||||||
if (SDL_GetDisplayBounds(monitor, &displayBounds) != 0)
|
if (SDL_GetDisplayUsableBounds(monitor, &displayBounds) == 0)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_ERROR, "Failed to get display bounds");
|
return (Vector2){ (float)displayBounds.x, (float)displayBounds.y };
|
||||||
return (Vector2) { 0, 0 };
|
|
||||||
}
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "SDL: Failed to get selected display usable bounds");
|
||||||
return (Vector2) { displayBounds.x, displayBounds.y };
|
}
|
||||||
|
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
|
||||||
|
return (Vector2){ 0.0f, 0.0f };
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get selected monitor width (currently used by monitor)
|
// Get selected monitor width (currently used by monitor)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user