Skip to content

Commit 792b7b4

Browse files
committed
Add more bindings
1 parent 389d0c1 commit 792b7b4

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

src/core.h

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,46 @@ static Janet cfun_SetGamepadVibration(int32_t argc, Janet *argv) {
10391039
return janet_wrap_nil();
10401040
}
10411041

1042+
static Janet cfun_GetWindowPosition(int32_t argc, Janet *argv) {
1043+
(void)argv;
1044+
janet_fixarity(argc, 0);
1045+
Vector2 position = GetWindowPosition();
1046+
return jaylib_wrap_vec2(position);
1047+
}
1048+
1049+
static Janet cfun_ToggleBorderlessWindowed(int32_t argc, Janet *argv) {
1050+
(void)argv;
1051+
janet_fixarity(argc, 0);
1052+
ToggleBorderlessWindowed();
1053+
return janet_wrap_nil();
1054+
}
1055+
1056+
static Janet cfun_SetMouseCursor(int32_t argc, Janet *argv) {
1057+
janet_fixarity(argc, 1);
1058+
int cursor = janet_getinteger(argv, 0);
1059+
SetMouseCursor(cursor);
1060+
janet_wrap_nil();
1061+
}
1062+
1063+
static Janet cfun_GetWorkingDirectory(int32_t argc, Janet *argv) {
1064+
(void)argv;
1065+
janet_fixarity(argc, 0);
1066+
return janet_wrap_string(GetWorkingDirectory());
1067+
}
1068+
1069+
static Janet cfun_IsKeyPressedRepeat(int argc, Janet *argv) {
1070+
janet_fixarity(argc, 1);
1071+
int key = jaylib_getkey(argv, 0);
1072+
return janet_wrap_boolean(IsKeyPressedRepeat(key));
1073+
}
1074+
1075+
static Janet cfun_PollInputEvents(int32_t argc, Janet *argv) {
1076+
(void)argv;
1077+
janet_fixarity(argc, 0);
1078+
PollInputEvents();
1079+
return janet_wrap_nil();
1080+
}
1081+
10421082
static JanetReg core_cfuns[] = {
10431083
{
10441084
"init-window", cfun_InitWindow,
@@ -1603,5 +1643,35 @@ static JanetReg core_cfuns[] = {
16031643
"(load-random-sequence count min max)\n\n"
16041644
"Load random values sequence, no values repeated, min and max included."
16051645
},
1646+
{
1647+
"get-window-position", cfun_GetWindowPosition,
1648+
"(get-window-position)\n\n"
1649+
"Get window position XY on monitor."
1650+
},
1651+
{
1652+
"toggle-borderless-windowed", cfun_LoadRandomSequence,
1653+
"(toggle-borderless-windowed)\n\n"
1654+
"Toggle window state."
1655+
},
1656+
{
1657+
"set-mouse-cursor", cfun_SetMouseCursor,
1658+
"(set-mouse-cursor cursor)\n\n"
1659+
"Set mouse cursor."
1660+
},
1661+
{
1662+
"get-working-directory", cfun_GetWorkingDirectory,
1663+
"(get-working-directory)\n\n"
1664+
"Get current working directory."
1665+
},
1666+
{
1667+
"key-pressed-repeat?", cfun_IsKeyPressedRepeat,
1668+
"(key-pressed-repeat?)\n\n"
1669+
"Check if a key has been pressed again."
1670+
},
1671+
{
1672+
"poll-input-events", cfun_PollInputEvents,
1673+
"(poll-input-events?)\n\n"
1674+
"Register all input events."
1675+
},
16061676
{NULL, NULL, NULL}
16071677
};

0 commit comments

Comments
 (0)