From 92b561030f7f713fc4e2893de05fdc7a06c8a139 Mon Sep 17 00:00:00 2001 From: realtradam Date: Mon, 24 Apr 2023 02:27:18 -0400 Subject: added positional inputs to input system --- include/rodeo.h | 8 -------- include/rodeo/input.h | 6 ++++++ include/rodeo/input_t.h | 29 +++++++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/rodeo.h b/include/rodeo.h index 2d43ce0..ba47491 100644 --- a/include/rodeo.h +++ b/include/rodeo.h @@ -149,11 +149,3 @@ rodeo_frame_limit_set(uint32_t limit); uint32_t rodeo_frame_limit_get(void); - -/// --- Input --- - -int32_t -rodeo_input_mouse_x_get(void); - -int32_t -rodeo_input_mouse_y_get(void); diff --git a/include/rodeo/input.h b/include/rodeo/input.h index 5c7cb1c..41a7849 100644 --- a/include/rodeo/input.h +++ b/include/rodeo/input.h @@ -45,6 +45,12 @@ rodeo_input_command_register_binary_mouseButton( rodeo_input_binary_mouseButton_t mouse_button ); +bool +rodeo_input_command_register_positional_mouse( + rodeo_input_command_t *input_command, + rodeo_input_positional_mouse_t mouse_position +); + // alternative proposed "general" registration methods //rodeo_input_command_register_binary(cmd, rodeo_input_binary_Scancode, rodeo_input_binary_scancode_Q ); //rodeo_input_command_register_any(cmd, rodeo_input_type_Binary, rodeo_input_binary_Scancode, rodeo_input_binary_scancode_Q ); diff --git a/include/rodeo/input_t.h b/include/rodeo/input_t.h index 39385da..6013eed 100644 --- a/include/rodeo/input_t.h +++ b/include/rodeo/input_t.h @@ -5,6 +5,7 @@ // -- system -- #include +#include // - SDL code start - @@ -762,11 +763,20 @@ rodeo_input_binary_mouseButton_t; // - SDL code end - +typedef +enum +{ + rodeo_input_positional_mouse_X = 1, + rodeo_input_positional_mouse_Y = 2 +} +rodeo_input_positional_mouse_t; + typedef enum { rodeo_input_type_Invalid = (1 << 0), - rodeo_input_type_Binary = (1 << 1) + rodeo_input_type_Binary = (1 << 1), + rodeo_input_type_Positional = (1 << 2), } rodeo_input_type_t ; @@ -788,12 +798,15 @@ enum } rodeo_input_binary_state_t; +typedef int64_t rodeo_input_positional_state_t; + typedef struct { union { rodeo_input_binary_state_t binary_state; + rodeo_input_positional_state_t positional_state; } data; rodeo_input_type_t input_type; @@ -818,12 +831,17 @@ void #define i_tag input_binary_mouseButtons #include +#define i_val rodeo_input_positional_mouse_t +#define i_tag input_positional_mouse +#include + typedef struct { uint32_t valid_types; // rodeo_input_type_t - //rodeo_input_callback_function *callback; + cset_input_callback_functions callbacks; + // binary struct { @@ -831,6 +849,13 @@ struct cset_input_binary_mouseButtons mouse_buttons; } binary; + + // unbounded range + struct + { + cset_input_positional_mouse mouse_position; + } + unbounded_range; } rodeo_input_command_t; -- cgit v1.2.3