X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=vg%2Fvg_input.h;h=62d4690a68e2acfa2673a6af7e7992959d42ca82;hb=7d33b1d4576c1e35cd03ee3034840b8053914ae1;hp=6bae274d99cff79a25e39c220a6742463578eb60;hpb=b5886bcf2a79ad14e586d69ee9fd01f87bac9c95;p=fishladder.git diff --git a/vg/vg_input.h b/vg/vg_input.h index 6bae274..62d4690 100644 --- a/vg/vg_input.h +++ b/vg/vg_input.h @@ -5,6 +5,14 @@ static inline int vg_get_button( const char *button ) __attribute__((unused)); static inline int vg_get_button_down( const char *button ) __attribute__((unused)); static inline int vg_get_button_up( const char *button ) __attribute__((unused)); +enum vg_button_state +{ + k_button_state_down = 1, + k_button_state_up = 3, + k_button_state_pressed = 2, + k_button_state_none = 0 +}; + // Input // =========================================================================================================== GLFWgamepadstate vg_gamepad; @@ -89,12 +97,12 @@ static inline int vg_get_button_up( const char *button ) return bind->prev & (bind->value ^ bind->prev) && !vg_console_enabled(); } -static inline int vg_get_button_state( const char *button ) +static inline enum vg_button_state vg_get_button_state( const char *button ) { - if( vg_get_button_down( button ) ) return 1; - if( vg_get_button_up( button ) ) return 3; - if( vg_get_button( button ) ) return 2; - return 0; + if( vg_get_button_down( button ) ) return k_button_state_down; + if( vg_get_button_up( button ) ) return k_button_state_up; + if( vg_get_button( button ) ) return k_button_state_pressed; + return k_button_state_none; } static inline int key_is_keyboard( int const id )