Skip to content

Commit 3a034bb

Browse files
committed
add get-window-position to allow access to GetWindowPosition()
1 parent 4875309 commit 3a034bb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

api.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
[x] void SetWindowMonitor(int monitor)
1717
[x] void SetWindowMinSize(int width, int height)
1818
[x] void SetWindowSize(int width, int height)
19+
[x] Vector2 GetWindowPosition()
1920
[x] void *GetWindowHandle(void)
2021
[x] int GetScreenWidth(void)
2122
[x] int GetScreenHeight(void)

src/core.h

+11
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,13 @@ static Janet cfun_GetMonitorPhysicalHeight(int32_t argc, Janet *argv) {
246246
return janet_wrap_integer(GetMonitorPhysicalHeight(monitor));
247247
}
248248

249+
static Janet cfun_GetWindowPosition(int32_t argc, Janet *argv) {
250+
(void) argv;
251+
janet_fixarity(argc, 0);
252+
Vector2 position = GetWindowPosition();
253+
return jaylib_wrap_vec2(position);
254+
}
255+
249256
static Janet cfun_GetWindowScaleDPI(int32_t argc, Janet *argv) {
250257
(void) argv;
251258
janet_fixarity(argc, 0);
@@ -1023,6 +1030,10 @@ static JanetReg core_cfuns[] = {
10231030
{"get-monitor-physical-height", cfun_GetMonitorPhysicalHeight,
10241031
"(get-monitor-physical-height monitor)\n\n"
10251032
"Get specified monitor physical height in millimetres"
1033+
},
1034+
{"get-window-position", cfun_GetWindowPosition,
1035+
"(get-window-position)\n\n"
1036+
"Get the window position on screen"
10261037
},
10271038
{"get-window-scale-dpi", cfun_GetWindowScaleDPI,
10281039
"(get-window-scale-dpi)\n\n"

0 commit comments

Comments
 (0)