X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=input.h;h=a909d7b70e537a94c8830a3b94413e46ef7ceb98;hb=7fb47c3eb672f4468da8b5b452c09d44e1389d5f;hp=6f19634f606e4dde10fd52754dbcaf9d3804cd66;hpb=223e75026f958029f9664380ed20a5daa3ee2ae7;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/input.h b/input.h index 6f19634..a909d7b 100644 --- a/input.h +++ b/input.h @@ -47,6 +47,7 @@ struct { float axis_states[ k_sraxis_max ][2]; v2f joystick_states[ k_srjoystick_max ][2]; u8 button_states[ k_srbind_max ][2]; + u32 ignore_input_frames; } static srinput; @@ -178,8 +179,8 @@ static const char *joystick_display_string( enum sr_joystick joystick ) static int buttons_filter_fixed(void) { - if( vg_console.enabled ) - return 1; + if( srinput.ignore_input_frames ) return 1; + if( vg_ui.wants_mouse ) return 1; if( vg.engine_stage == k_engine_stage_update_fixed ) if( vg.fixed_iterations > 0 ) @@ -191,8 +192,7 @@ static int buttons_filter_fixed(void) /* Rising edge of button */ static int button_down( enum sr_bind button ) { - if( buttons_filter_fixed() ) - return 0; + if( buttons_filter_fixed() ) return 0; if( srinput.button_states[ button ][0] && !srinput.button_states[ button ][1] ) @@ -204,8 +204,7 @@ static int button_down( enum sr_bind button ) /* Falling edge of button */ static int button_up( enum sr_bind button ) { - if( buttons_filter_fixed() ) - return 0; + if( buttons_filter_fixed() ) return 0; if( !srinput.button_states[ button ][0] && srinput.button_states[ button ][1] ) @@ -217,15 +216,13 @@ static int button_up( enum sr_bind button ) /* State of button */ static int button_press( enum sr_bind button ) { - if( vg_console.enabled ) - return 0; - + if( vg_ui.wants_mouse ) return 0; return srinput.button_states[ button ][0]; } static void joystick_state( enum sr_joystick joystick, v2f state ) { - if( vg_console.enabled ) + if( vg_ui.wants_mouse ) v2_zero( state ); else v2_copy( srinput.joystick_states[ joystick ][0], state ); @@ -233,7 +230,7 @@ static void joystick_state( enum sr_joystick joystick, v2f state ) static float axis_state( enum sr_axis axis ) { - if( vg_console.enabled ) return 0.0f; + if( vg_ui.wants_mouse ) return 0.0f; else return srinput.axis_states[axis][0]; } @@ -244,6 +241,9 @@ static void setbtn( enum sr_bind button, u8 value ) static void skaterift_preupdate_inputs(void) { + if( srinput.ignore_input_frames ) + srinput.ignore_input_frames --; + for( u32 i=0; i= 0 ){ struct vg_controller *controller = &vg_input.controllers[vg_input.active_controller_index];