VG_STATIC inline int vg_get_button_down( const char *button );
VG_STATIC inline int vg_get_button_up( const char *button );
+VG_STATIC float g_controller_deadzone = 0.05f;
+
enum vg_button_state
{
k_button_state_down = 1,
gamepad_value *= -1.0f;
}
- if( fabsf(gamepad_value) <= 0.01f )
- gamepad_value = 0.0f;
+ float deadz = vg_clampf( g_controller_deadzone, 0.0f, 0.999f ),
+ high = vg_maxf( 0.0f, fabsf(gamepad_value) - deadz ),
+ norm = high / (1.0f-deadz);
+
+ gamepad_value = vg_signf( gamepad_value ) * norm;
if( fabsf(keyboard_value) > fabsf(gamepad_value) )
bind->axis.value = keyboard_value;
.function = vg_rebind_input_cmd
});
+ vg_convar_push( (struct vg_convar){
+ .name = "controller_deadzone",
+ .data = &g_controller_deadzone,
+ .data_type = k_convar_dtype_f32,
+ .opt_f32 = { .clamp = 0 },
+ .persistent = 1
+ });
+
vg_info( "Checking for controller\n" );
SDL_GameControllerAddMappingsFromFile( "gamecontrollerdb.txt" );
{
if( size % 8 )
{
- vg_error( "Requested size: %u\n", size );
- vg_fatal_exit_loop( "8 byte alignment required" );
+ vg_error( "alloc(%u) is not 8 byte aligned\n", size );
+ size = vg_align8( size );
}
vg_linear_allocator *alloc = vg_linear_header( buffer );
vg_uictx.max_indices = 20000;
vg_uictx.max_verts = 30000;
+ vg_uictx.colours = &ui_default_colours;
/* Generate the buffer we are gonna be drawing to */
glGenVertexArrays( 1, &vg_uictx.vao );