diff options
| author | realtradam <[email protected]> | 2023-04-24 02:27:18 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2023-04-24 02:27:18 -0400 |
| commit | 92b561030f7f713fc4e2893de05fdc7a06c8a139 (patch) | |
| tree | e48f6719d839f12e4a11281d0c29cef25e21b747 /include | |
| parent | cb3c2a69576168a3193151f14d6c1f4aeaa30e0b (diff) | |
| download | RodeoKit-92b561030f7f713fc4e2893de05fdc7a06c8a139.tar.gz RodeoKit-92b561030f7f713fc4e2893de05fdc7a06c8a139.zip | |
added positional inputs to input system
Diffstat (limited to 'include')
| -rw-r--r-- | include/rodeo.h | 8 | ||||
| -rw-r--r-- | include/rodeo/input.h | 6 | ||||
| -rw-r--r-- | include/rodeo/input_t.h | 29 |
3 files changed, 33 insertions, 10 deletions
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 <stdbool.h> +#include <stdint.h> // - SDL code start - @@ -765,8 +766,17 @@ rodeo_input_binary_mouseButton_t; 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 <stc/cset.h> +#define i_val rodeo_input_positional_mouse_t +#define i_tag input_positional_mouse +#include <stc/cset.h> + 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; |
