From 1836e02c1ef9909d25bbb89b9d9fdd6ec934aada Mon Sep 17 00:00:00 2001 From: ChrisDill Date: Thu, 27 Sep 2018 15:52:56 +0100 Subject: Added monitor functions - Get number of monitors - Get size, physical size and name of primary monitor. Could pass monitor id instead not sure. --- src/core.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src/core.c') diff --git a/src/core.c b/src/core.c index fc1a5a09..e785e735 100644 --- a/src/core.c +++ b/src/core.c @@ -770,6 +770,55 @@ int GetScreenHeight(void) return screenHeight; } +// Get number of monitors +int GetMonitorCount(void) +{ + int monitorCount; + glfwGetMonitors(&monitorCount); + return monitorCount; +} + +// Get primary monitor width +int GetMonitorWidth(void) +{ + GLFWmonitor *monitor = glfwGetPrimaryMonitor(); + const GLFWvidmode * mode = glfwGetVideoMode(monitor); + return mode->width; +} + +// Get primary monitor height +int GetMonitorHeight(void) +{ + GLFWmonitor *monitor = glfwGetPrimaryMonitor(); + const GLFWvidmode * mode = glfwGetVideoMode(monitor); + return mode->height; +} + +// Get primary montior physical width in millimetres +int GetMonitorPhysicalWidth(void) +{ + int physicalWidth; + GLFWmonitor *monitor = glfwGetPrimaryMonitor(); + glfwGetMonitorPhysicalSize(monitor, &physicalWidth, NULL); + return physicalWidth; +} + +// Get primary monitor physical height in millimetres +int GetMonitorPhysicalHeight(void) +{ + int physicalHeight; + GLFWmonitor *monitor = glfwGetPrimaryMonitor(); + glfwGetMonitorPhysicalSize(monitor, NULL, &physicalHeight); + return physicalHeight; +} + +// Get the human-readable, UTF-8 encoded name of the primary monitor +const char *GetMonitorName(void) +{ + GLFWmonitor *monitor = glfwGetPrimaryMonitor(); + return glfwGetMonitorName(monitor); +} + // Show mouse cursor void ShowCursor() { -- cgit v1.2.3