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;
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 )
/* 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] )
/* 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] )
/* 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 );
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];
}
static void skaterift_preupdate_inputs(void)
{
+ if( srinput.ignore_input_frames )
+ srinput.ignore_input_frames --;
+
for( u32 i=0; i<k_srbind_max; i++ ){
srinput.button_states[i][1] = srinput.button_states[i][0];
srinput.button_states[i][0] = 0;
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];