From 3a034bbf0e151d1ffbe6b27a49f3fbeac048bbdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20H=C3=BCbner?= Date: Sun, 8 Dec 2024 00:57:05 +0000 Subject: [PATCH] add get-window-position to allow access to GetWindowPosition() --- api.txt | 1 + src/core.h | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/api.txt b/api.txt index 9dbbbf6..b924f87 100644 --- a/api.txt +++ b/api.txt @@ -16,6 +16,7 @@ [x] void SetWindowMonitor(int monitor) [x] void SetWindowMinSize(int width, int height) [x] void SetWindowSize(int width, int height) +[x] Vector2 GetWindowPosition() [x] void *GetWindowHandle(void) [x] int GetScreenWidth(void) [x] int GetScreenHeight(void) diff --git a/src/core.h b/src/core.h index a893ef9..6e08aa1 100644 --- a/src/core.h +++ b/src/core.h @@ -246,6 +246,13 @@ static Janet cfun_GetMonitorPhysicalHeight(int32_t argc, Janet *argv) { return janet_wrap_integer(GetMonitorPhysicalHeight(monitor)); } +static Janet cfun_GetWindowPosition(int32_t argc, Janet *argv) { + (void) argv; + janet_fixarity(argc, 0); + Vector2 position = GetWindowPosition(); + return jaylib_wrap_vec2(position); +} + static Janet cfun_GetWindowScaleDPI(int32_t argc, Janet *argv) { (void) argv; janet_fixarity(argc, 0); @@ -1023,6 +1030,10 @@ static JanetReg core_cfuns[] = { {"get-monitor-physical-height", cfun_GetMonitorPhysicalHeight, "(get-monitor-physical-height monitor)\n\n" "Get specified monitor physical height in millimetres" + }, + {"get-window-position", cfun_GetWindowPosition, + "(get-window-position)\n\n" + "Get the window position on screen" }, {"get-window-scale-dpi", cfun_GetWindowScaleDPI, "(get-window-scale-dpi)\n\n"