Added platform check

- Added PLATFORM_DESKTOP check for Monitor functions to try to fix issue on android.
- Not sure what return types should be when not on desktop. Added rough guess for now.
This commit is contained in:
ChrisDill 2018-09-29 14:10:29 +01:00
parent ed79d53e1a
commit ed95337eb8

View file

@ -773,50 +773,68 @@ int GetScreenHeight(void)
// Get number of monitors // Get number of monitors
int GetMonitorCount(void) int GetMonitorCount(void)
{ {
#if defined(PLATFORM_DESKTOP)
int monitorCount; int monitorCount;
glfwGetMonitors(&monitorCount); glfwGetMonitors(&monitorCount);
return monitorCount; return monitorCount;
#endif
return 1;
} }
// Get primary monitor width // Get primary monitor width
int GetMonitorWidth(void) int GetMonitorWidth(void)
{ {
#if defined(PLATFORM_DESKTOP)
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); GLFWmonitor *monitor = glfwGetPrimaryMonitor();
const GLFWvidmode * mode = glfwGetVideoMode(monitor); const GLFWvidmode * mode = glfwGetVideoMode(monitor);
return mode->width; return mode->width;
#endif
return GetScreenWidth();
} }
// Get primary monitor height // Get primary monitor height
int GetMonitorHeight(void) int GetMonitorHeight(void)
{ {
#if defined(PLATFORM_DESKTOP)
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); GLFWmonitor *monitor = glfwGetPrimaryMonitor();
const GLFWvidmode * mode = glfwGetVideoMode(monitor); const GLFWvidmode * mode = glfwGetVideoMode(monitor);
return mode->height; return mode->height;
#endif
return GetScreenHeight();
} }
// Get primary montior physical width in millimetres // Get primary montior physical width in millimetres
int GetMonitorPhysicalWidth(void) int GetMonitorPhysicalWidth(void)
{ {
#if defined(PLATFORM_DESKTOP)
int physicalWidth; int physicalWidth;
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); GLFWmonitor *monitor = glfwGetPrimaryMonitor();
glfwGetMonitorPhysicalSize(monitor, &physicalWidth, NULL); glfwGetMonitorPhysicalSize(monitor, &physicalWidth, NULL);
return physicalWidth; return physicalWidth;
#endif
return 0;
} }
// Get primary monitor physical height in millimetres // Get primary monitor physical height in millimetres
int GetMonitorPhysicalHeight(void) int GetMonitorPhysicalHeight(void)
{ {
#if defined(PLATFORM_DESKTOP)
int physicalHeight; int physicalHeight;
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); GLFWmonitor *monitor = glfwGetPrimaryMonitor();
glfwGetMonitorPhysicalSize(monitor, NULL, &physicalHeight); glfwGetMonitorPhysicalSize(monitor, NULL, &physicalHeight);
return physicalHeight; return physicalHeight;
#endif
return 0;
} }
// Get the human-readable, UTF-8 encoded name of the primary monitor // Get the human-readable, UTF-8 encoded name of the primary monitor
const char *GetMonitorName(void) const char *GetMonitorName(void)
{ {
#if defined(PLATFORM_DESKTOP)
GLFWmonitor *monitor = glfwGetPrimaryMonitor(); GLFWmonitor *monitor = glfwGetPrimaryMonitor();
return glfwGetMonitorName(monitor); return glfwGetMonitorName(monitor);
#endif
return "";
} }
// Show mouse cursor // Show mouse cursor