aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2019-09-10 12:43:44 +0200
committerRay <raysan5@gmail.com>2019-09-10 12:43:44 +0200
commit0a2177b4bc387951e69a2259f3cd78714d18de38 (patch)
tree67fd304bcfacda08f1e13d4d60aa4c4a9b757669
parentae2452d280a07952529ea82bcc2288d73bc3ccdf (diff)
downloadraylib-0a2177b4bc387951e69a2259f3cd78714d18de38.tar.gz
raylib-0a2177b4bc387951e69a2259f3cd78714d18de38.zip
ADDED: GetWindowPosition()
-rw-r--r--src/core.c11
-rw-r--r--src/raylib.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index 1506a4fa..fad2c485 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1064,6 +1064,17 @@ int GetMonitorPhysicalHeight(int monitor)
return 0;
}
+// Get window position XY on monitor
+Vector2 GetWindowPosition(void)
+{
+ int x = 0;
+ int y = 0;
+#if defined(PLATFORM_DESKTOP)
+ glfwGetWindowPos(window, &x, &y);
+#endif
+ return (Vector2){ (float)x, (float)y };
+}
+
// Get the human-readable, UTF-8 encoded name of the primary monitor
const char *GetMonitorName(int monitor)
{
diff --git a/src/raylib.h b/src/raylib.h
index 3bbf471b..d90dedf0 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -882,6 +882,7 @@ RLAPI int GetMonitorWidth(int monitor); // Get primary
RLAPI int GetMonitorHeight(int monitor); // Get primary monitor height
RLAPI int GetMonitorPhysicalWidth(int monitor); // Get primary monitor physical width in millimetres
RLAPI int GetMonitorPhysicalHeight(int monitor); // Get primary monitor physical height in millimetres
+RLAPI Vector2 GetWindowPosition(void); // Get window position XY on monitor
RLAPI const char *GetMonitorName(int monitor); // Get the human-readable, UTF-8 encoded name of the primary monitor
RLAPI const char *GetClipboardText(void); // Get clipboard text content
RLAPI void SetClipboardText(const char *text); // Set clipboard text content