From 0627f1345d441f1774d8bf8073e83f3a286e4a28 Mon Sep 17 00:00:00 2001 From: Lukas Krickl Date: Sun, 1 Mar 2026 16:28:03 +0100 Subject: [PATCH] inputs: Added interfce for detecting action presses --- src/i_input.c | 16 ++++++++++++++++ src/i_input.h | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/i_input.c b/src/i_input.c index 903d97b..d50cc48 100644 --- a/src/i_input.c +++ b/src/i_input.c @@ -85,6 +85,22 @@ void i_input_cursor_action_unset(void) { i_input_map.inputs[I_INPUT_ACTION_CURSOR_ACTION].held = 0; } + +lrts_bool i_input_just_pressed(enum i_input_actions action) { + LRTS_UNUSED(action); + return LRTS_FALSE; +} + +lrts_bool i_input_held(enum i_input_actions action) { + LRTS_UNUSED(action); + return LRTS_FALSE; +} + +lrts_bool i_input_double_press(enum i_input_actions action) { + LRTS_UNUSED(action); + return LRTS_FALSE; +} + void i_input_poll(void) { p_poll_events(); i_input_update(); diff --git a/src/i_input.h b/src/i_input.h index b9a1204..3669ddd 100644 --- a/src/i_input.h +++ b/src/i_input.h @@ -92,6 +92,16 @@ void i_input_cursor_click_unset(void); void i_input_cursor_drag_unset(void); void i_input_cursor_action_unset(void); +/* returns true if this action was just performed this frame */ +lrts_bool i_input_just_pressed(enum i_input_actions action); + +/* returns true if this action is held for more than 1 frame */ +lrts_bool i_input_held(enum i_input_actions action); + +/* returns true if the action was clicked twice within a + * delay window causing a double click */ +lrts_bool i_input_double_press(enum i_input_actions action); + /* polls input from system backend * and translates the input to commands */ -- 2.30.2