Add more missing implementations 5

This commit is contained in:
ubkp 2023-10-18 00:33:00 -03:00
parent 4262f6d218
commit bc19f4a049

View File

@ -332,7 +332,7 @@ void SetWindowOpacity(float opacity)
// Set window focused // Set window focused
void SetWindowFocused(void) void SetWindowFocused(void)
{ {
TRACELOG(LOG_WARNING, "SetWindowFocused() not available on target platform"); SDL_RaiseWindow(platform.window);
} }
// Get native window handle // Get native window handle
@ -406,15 +406,45 @@ int GetMonitorHeight(int monitor)
// Get selected monitor physical width in millimetres // Get selected monitor physical width in millimetres
int GetMonitorPhysicalWidth(int monitor) int GetMonitorPhysicalWidth(int monitor)
{ {
TRACELOG(LOG_WARNING, "GetMonitorPhysicalWidth() not implemented on target platform"); int width = 0;
return 0;
int monitorCount = 0;
monitorCount = SDL_GetNumVideoDisplays();
if ((monitor >= 0) && (monitor < monitorCount))
{
float vdpi = 0.0f;
SDL_GetDisplayDPI(monitor, NULL, NULL, &vdpi);
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(monitor, &mode);
// Calculate size on inches, then convert to millimeter
if (vdpi > 0.0f) width = (mode.w/vdpi)*25.4f;
}
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
return width;
} }
// Get selected monitor physical height in millimetres // Get selected monitor physical height in millimetres
int GetMonitorPhysicalHeight(int monitor) int GetMonitorPhysicalHeight(int monitor)
{ {
TRACELOG(LOG_WARNING, "GetMonitorPhysicalHeight() not implemented on target platform"); int height = 0;
return 0;
int monitorCount = 0;
monitorCount = SDL_GetNumVideoDisplays();
if ((monitor >= 0) && (monitor < monitorCount))
{
float vdpi = 0.0f;
SDL_GetDisplayDPI(monitor, NULL, NULL, &vdpi);
SDL_DisplayMode mode;
SDL_GetCurrentDisplayMode(monitor, &mode);
// Calculate size on inches, then convert to millimeter
if (vdpi > 0.0f) height = (mode.h/vdpi)*25.4f;
}
else TRACELOG(LOG_WARNING, "SDL: Failed to find selected monitor");
return height;
} }
// Get selected monitor refresh rate // Get selected monitor refresh rate