Skip to content

Commit

Permalink
add get-window-position to allow access to GetWindowPosition()
Browse files Browse the repository at this point in the history
  • Loading branch information
profan committed Dec 8, 2024
1 parent 4875309 commit 3a034bb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions src/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 3a034bb

Please sign in to comment.