Browse Source

Add GetMonitorScale()

pull/4525/head
asdqwe 4 weeks ago
parent
commit
626ef8f9d2
8 changed files with 56 additions and 0 deletions
  1. +7
    -0
      src/platforms/rcore_android.c
  2. +13
    -0
      src/platforms/rcore_desktop_glfw.c
  3. +7
    -0
      src/platforms/rcore_desktop_rgfw.c
  4. +7
    -0
      src/platforms/rcore_desktop_sdl.c
  5. +7
    -0
      src/platforms/rcore_drm.c
  6. +7
    -0
      src/platforms/rcore_template.c
  7. +7
    -0
      src/platforms/rcore_web.c
  8. +1
    -0
      src/raylib.h

+ 7
- 0
src/platforms/rcore_android.c View File

@ -480,6 +480,13 @@ int GetMonitorRefreshRate(int monitor)
return 0;
}
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorScale() not implemented on target platform");
return 0;
}
// Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor)
{

+ 13
- 0
src/platforms/rcore_desktop_glfw.c View File

@ -921,6 +921,19 @@ int GetMonitorRefreshRate(int monitor)
return refresh;
}
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
Vector2 scale = { 1.0f, 1.0f };
int monitorCount = 0;
GLFWmonitor **monitors = glfwGetMonitors(&monitorCount);
if ((monitor >= 0) && (monitor < monitorCount)) glfwGetMonitorContentScale(monitors[monitor], &scale.x, &scale.y);
else TRACELOG(LOG_WARNING, "GLFW: Failed to find selected monitor");
return scale;
}
// Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor)
{

+ 7
- 0
src/platforms/rcore_desktop_rgfw.c View File

@ -629,6 +629,13 @@ int GetMonitorRefreshRate(int monitor)
return 0;
}
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorScale() not implemented on target platform");
return 0;
}
// Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor)
{

+ 7
- 0
src/platforms/rcore_desktop_sdl.c View File

@ -1036,6 +1036,13 @@ int GetMonitorRefreshRate(int monitor)
return refresh;
}
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorScale() not implemented on target platform");
return 0;
}
// Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor)
{

+ 7
- 0
src/platforms/rcore_drm.c View File

@ -466,6 +466,13 @@ int GetMonitorRefreshRate(int monitor)
return refresh;
}
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorScale() not implemented on target platform");
return 0;
}
// Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor)
{

+ 7
- 0
src/platforms/rcore_template.c View File

@ -257,6 +257,13 @@ int GetMonitorRefreshRate(int monitor)
return 0;
}
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorScale() not implemented on target platform");
return 0;
}
// Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor)
{

+ 7
- 0
src/platforms/rcore_web.c View File

@ -751,6 +751,13 @@ int GetMonitorRefreshRate(int monitor)
return 0;
}
// Get specified monitor scale
Vector2 GetMonitorScale(int monitor)
{
TRACELOG(LOG_WARNING, "GetMonitorScale() not implemented on target platform");
return 0;
}
// Get the human-readable, UTF-8 encoded name of the selected monitor
const char *GetMonitorName(int monitor)
{

+ 1
- 0
src/raylib.h View File

@ -1006,6 +1006,7 @@ RLAPI int GetMonitorHeight(int monitor); // Get specifi
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get specified monitor physical width in millimetres
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get specified monitor physical height in millimetres
RLAPI int GetMonitorRefreshRate(int monitor); // Get specified monitor refresh rate
RLAPI Vector2 GetMonitorScale(int monitor); // Get specified monitor scale
RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
RLAPI Vector2 GetWindowScaleDPI(void); // Get window scale DPI factor
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the specified monitor

Loading…
Cancel
Save