From 0a984656f5fec68c90acc612b01f897918c0070b Mon Sep 17 00:00:00 2001 From: omnisci3nce Date: Fri, 19 Jul 2024 16:47:15 +1000 Subject: handle right btn as well --- src/systems/input.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/systems/input.h') diff --git a/src/systems/input.h b/src/systems/input.h index ce6e190..bf80a84 100644 --- a/src/systems/input.h +++ b/src/systems/input.h @@ -8,13 +8,19 @@ struct GLFWWindow; +typedef enum MouseBtn { + MOUSEBTN_LEFT = 0, + MOUSEBTN_RIGHT = 1, + MOUSEBTN_MIDDLE = 2, +} MouseBtn; + typedef struct mouse_state { i32 x; i32 y; i32 x_delta; i32 y_delta; - bool prev_left_btn_pressed; - bool left_btn_pressed; + bool prev_pressed_states[3]; + bool cur_pressed_states[3]; } mouse_state; typedef struct Input_State { @@ -35,7 +41,7 @@ bool key_just_pressed(keycode key); bool key_just_released(keycode key); // TODO: right btn as well -bool MouseBtn_Held(); +bool MouseBtn_Held(MouseBtn btn); // --- Lifecycle -- cgit v1.2.3-70-g09d2