X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=input.h;h=a909d7b70e537a94c8830a3b94413e46ef7ceb98;hb=e8a65239f85784e2e596d2622c2baddda9fb5fae;hp=dffcb28235221648b4250c63eb60359801b088ce;hpb=f24a8cdd8ea6c3d762d26de2fc0700599bedbcad;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/input.h b/input.h index dffcb28..a909d7b 100644 --- a/input.h +++ b/input.h @@ -179,11 +179,8 @@ static const char *joystick_display_string( enum sr_joystick joystick ) static int buttons_filter_fixed(void) { - if( srinput.ignore_input_frames ) - return 1; - - 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 ) @@ -195,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] ) @@ -208,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] ) @@ -221,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 ); @@ -237,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]; } @@ -312,7 +305,7 @@ static void skaterift_preupdate_inputs(void) if( vg_getkey( SDLK_RIGHT ) ) srinput.axis_states[ k_sraxis_mbrowse_h ][0] += 1.0f; - if( vg_input.active_controller_index != -1 ){ + if( vg_input.active_controller_index >= 0 ){ struct vg_controller *controller = &vg_input.controllers[vg_input.active_controller_index];