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..351720c 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); @@ -1024,6 +1031,10 @@ static JanetReg core_cfuns[] = { "(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" "Get window scale DPI factor"