Skip to content

Commit

Permalink
More updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chukobyte committed Mar 23, 2024
1 parent 552ccbb commit 59e0f66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions seika/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,19 @@ SkaVector2 ska_input_get_axis_input(SkaInputAxis axis, SkaInputDeviceIndex devic
}

// Input Action
SkaInputActionHandle ska_input_add_input_action(const char* actionName, const SkaInputAction* action, SkaInputDeviceIndex deviceIndex) {
SkaInputActionHandle ska_input_add_input_action(const char* actionName, const SkaInputActionValue* actionValues, SkaInputDeviceIndex deviceIndex) {
SKA_ASSERT(inputState.inputActionHandleIndex + 1 < SKA_INPUT_MAX_INPUT_ACTIONS);
const SkaInputActionHandle newHandle = inputState.inputActionHandleIndex++;
inputState.inputActionData[deviceIndex][newHandle].handle = newHandle;
inputState.inputActionData[deviceIndex][newHandle].action = *action;
SkaInputActionData* actionData = &inputState.inputActionData[deviceIndex][newHandle];
actionData->handle = newHandle;
actionData->action.name = ska_strdup(actionName);
actionData->action.actionValuesCount = 0;
for (size_t i = 0; i < SKA_INPUT_MAX_INPUT_ACTION_VALUES; i++) {
if (actionValues[i].key == SkaInputKey_INVALID) {
break;
}
actionData->action.actionValues[i] = actionValues[i];
}
return newHandle;
}

Expand Down
2 changes: 1 addition & 1 deletion seika/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ f32 ska_input_get_key_strength(SkaInputKey key, SkaInputDeviceIndex deviceIndex)
SkaVector2 ska_input_get_axis_input(SkaInputAxis axis, SkaInputDeviceIndex deviceIndex);

// Input Action
SkaInputActionHandle ska_input_add_input_action(const char* actionName, const SkaInputAction* action, SkaInputDeviceIndex deviceIndex);
SkaInputActionHandle ska_input_add_input_action(const char* actionName, const SkaInputActionValue* actionValues, SkaInputDeviceIndex deviceIndex);
SkaInputAction* ska_input_get_input_action(SkaInputActionHandle handle, SkaInputDeviceIndex deviceIndex);
bool ska_input_remove_input_action(SkaInputActionHandle handle, SkaInputDeviceIndex deviceIndex);
SkaInputActionHandle ska_input_find_input_action_handle(const char* actionName, SkaInputDeviceIndex deviceIndex);
Expand Down

0 comments on commit 59e0f66

Please sign in to comment.