summaryrefslogtreecommitdiff
path: root/sources/rl/core.h
diff options
context:
space:
mode:
authorhenriquelalves <henriquelalves@gmail.com>2024-05-26 14:39:55 +0300
committerhenriquelalves <henriquelalves@gmail.com>2024-05-26 14:39:55 +0300
commit56a3d75bbbd80512f76817a05eebaabdcaf37ae2 (patch)
treef6e3b87c484ebe3df51d6e43d9e76b4ded9efb01 /sources/rl/core.h
parent0a89a84956311f17648bb443e429dab25d35f0cc (diff)
downloadgamejam-slgj-2024-56a3d75bbbd80512f76817a05eebaabdcaf37ae2.tar.gz
gamejam-slgj-2024-56a3d75bbbd80512f76817a05eebaabdcaf37ae2.tar.bz2
gamejam-slgj-2024-56a3d75bbbd80512f76817a05eebaabdcaf37ae2.zip
Update for SLGJ 2024
Diffstat (limited to 'sources/rl/core.h')
-rw-r--r--sources/rl/core.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/sources/rl/core.h b/sources/rl/core.h
index 09c5555..14d8ba6 100644
--- a/sources/rl/core.h
+++ b/sources/rl/core.h
@@ -11,12 +11,22 @@ static s7_pointer rl_get_mouse_position(s7_scheme *s7, s7_pointer args) {
return vec;
}
+static s7_pointer rl_is_mouse_button_pressed(s7_scheme *s7, s7_pointer args) {
+ bool isPressed = IsMouseButtonPressed(0);
+ return(s7_make_boolean(s7, isPressed));
+}
+
static s7_pointer rl_is_key_down(s7_scheme *s7, s7_pointer args) {
int key = s7_integer(s7_car(args));
bool isKey = IsKeyDown(key);
return(s7_make_boolean(s7, isKey));
}
+static s7_pointer rl_get_frame_time(s7_scheme *s7, s7_pointer args) {
+ float dt = GetFrameTime();
+ return(s7_make_real(s7, dt));
+}
+
static s7_pointer rl_get_char_pressed(s7_scheme *s7, s7_pointer args) {
int key = GetCharPressed();
return(s7_make_integer(s7, key));
@@ -32,4 +42,6 @@ static void rl_core_define_methods(s7_scheme *s7) {
s7_define_function(s7, "rl-get-mouse-position", rl_get_mouse_position, 0, 0, false, "(rl-get-mouse-position)");
s7_define_function(s7, "rl-get-char-pressed", rl_get_char_pressed, 0, 0, false, "(rl-get-char-pressed)");
s7_define_function(s7, "rl-get-key-pressed", rl_get_key_pressed, 0, 0, false, "(rl-get-key-pressed)");
+ s7_define_function(s7, "rl-get-frame-time", rl_get_frame_time, 0, 0, false, "(rl-get-frame-time)");
+ s7_define_function(s7, "rl-is-mouse-button-pressed", rl_is_mouse_button_pressed, 0, 0, false, "(rl_is_mouse_button_pressed)");
}