feat: added compositeaxis1d_from_keys and from_buttons

This required moving InputDelegateFn from input.h to input_axis.h
This commit is contained in:
Sara 2024-01-12 12:26:23 +01:00
parent 1dc6f8352a
commit aca01507ed
4 changed files with 21 additions and 12 deletions

View file

@ -38,16 +38,8 @@ impl_PhysicsEntity_for(Player,
static inline
void Internal_PlayerInitInput(Player* self) {
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_new(
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_A)),
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_D)),
InputEvent_Float)), (InputDelegateFn)PlayerHorizontalInput);
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_new(
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_S)),
KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_W)),
InputEvent_Float)), (InputDelegateFn)PlayerVerticalInput);
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_A, SDL_SCANCODE_D)), (InputDelegateFn)PlayerHorizontalInput);
playerinput_add(self->playerInput, CompositeAxis1D_as_InputAxis(compositeaxis1d_from_keys(SDL_SCANCODE_S, SDL_SCANCODE_W)), (InputDelegateFn)PlayerVerticalInput);
playerinput_add(self->playerInput, KeyBind_as_InputAxis(keybind_new(SDL_SCANCODE_J)), (InputDelegateFn)PlayerAttackInput);
}