k_srbind_world_right,
k_srbind_home,
k_srbind_lobby,
+ k_srbind_chat,
k_srbind_max,
};
[k_srbind_replay_freecam]=controller_glyph(SDL_CONTROLLER_BUTTON_Y ),
[k_srbind_replay_resume]=controller_glyph( SDL_CONTROLLER_BUTTON_A ),
[k_srbind_sit] = controller_glyph( SDL_CONTROLLER_BUTTON_B ),
- [k_srbind_lobby] = controller_glyph( SDL_CONTROLLER_BUTTON_DPAD_LEFT )
+ [k_srbind_lobby] = controller_glyph( SDL_CONTROLLER_BUTTON_DPAD_LEFT ),
+ [k_srbind_chat] = ""
};
const char *keyboard_table[ k_srbind_max ] = {
[k_srbind_replay_freecam] = KEYBOARD_GLYPH( "F" ),
[k_srbind_replay_resume]= "\xa1",
[k_srbind_sit] = KEYBOARD_GLYPH( "Z" ),
- [k_srbind_lobby] = KEYBOARD_GLYPH( "" ) // FIXME: what is tab?
+ [k_srbind_lobby] = KEYBOARD_GLYPH( "" ), // FIXME: what is tab?
+ [k_srbind_chat] = KEYBOARD_GLYPH( "Y" )
};
if( vg_input.display_input_method == k_input_method_controller )
else return keyboard_table[ joystick ][axis];
}
-static int buttons_filter_fixed(void)
-{
- if( !srinput.enabled ) return 1;
- if( vg_ui.wants_mouse ) return 1;
+static int input_filter_generic(void){
+ if( !srinput.enabled || vg_ui.wants_mouse || vg_console.enabled )
+ return 1;
+ else
+ return 0;
+}
+
+static int buttons_filter_fixed(void){
+ if( input_filter_generic() )
+ 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 )
-{
+static int button_down( enum sr_bind button ){
if( buttons_filter_fixed() ) return 0;
if( srinput.button_states[ button ][0] &&
}
/* Falling edge of button */
-static int button_up( enum sr_bind button )
-{
+static int button_up( enum sr_bind button ){
if( buttons_filter_fixed() ) return 0;
if( !srinput.button_states[ button ][0] &&
}
/* State of button */
-static int button_press( enum sr_bind button )
-{
- if( vg_ui.wants_mouse ) return 0;
- return srinput.button_states[ button ][0];
+static int button_press( enum sr_bind button ){
+ if( input_filter_generic() )
+ return 0;
+ return
+ srinput.button_states[ button ][0];
}
-static void joystick_state( enum sr_joystick joystick, v2f state )
-{
- if( vg_ui.wants_mouse )
+static void joystick_state( enum sr_joystick joystick, v2f state ){
+ if( input_filter_generic() )
v2_zero( state );
else
v2_copy( srinput.joystick_states[ joystick ][0], state );
}
static float axis_state( enum sr_axis axis ){
- if( vg_ui.wants_mouse ) return 0.0f;
- else return srinput.axis_states[axis][0];
+ if( input_filter_generic() )
+ return 0.0f;
+ else
+ return srinput.axis_states[axis][0];
}
static void setbtn( enum sr_bind button, u8 value )
setbtn( k_srbind_replay_resume, vg_getkey(SDLK_SPACE) );
setbtn( k_srbind_sit, vg_getkey(SDLK_z) );
setbtn( k_srbind_lobby, vg_getkey(SDLK_TAB) );
+ setbtn( k_srbind_chat, vg_getkey(SDLK_y) );
/* axis
* --------------------------------------------*/
setbtn( k_srbind_replay_freecam, buttons[ SDL_CONTROLLER_BUTTON_Y ] );
setbtn( k_srbind_sit, buttons[ SDL_CONTROLLER_BUTTON_B ] );
setbtn( k_srbind_lobby, buttons[ SDL_CONTROLLER_BUTTON_DPAD_LEFT ] );
+ // k_srbind_chat
float *axis = controller->axises;
float *steer = srinput.joystick_states[ k_srjoystick_steer ][0],