Rename Phase > State

This commit is contained in:
Olly Rybak
2023-05-12 00:25:03 +10:00
parent d5237715a5
commit 4b4bf833a9
3 changed files with 10 additions and 10 deletions

View File

@@ -266,7 +266,7 @@ API_ENUM() enum class InputActionMode
/// <summary>
/// The input action event phases.
/// </summary>
API_ENUM() enum class InputActionPhase
API_ENUM() enum class InputActionState
{
/// <summary>
/// The key/button is not assigned.

View File

@@ -29,13 +29,13 @@ struct ActionData
{
bool Active;
uint64 FrameIndex;
InputActionPhase Phase;
InputActionState Phase;
ActionData()
{
Active = false;
FrameIndex = 0;
Phase = InputActionPhase::Waiting;
Phase = InputActionState::Waiting;
}
};
@@ -599,14 +599,14 @@ bool Input::GetAction(const StringView& name)
return e ? e->Active : false;
}
InputActionPhase Input::GetActionPhase(const StringView& name)
InputActionState Input::GetActionState(const StringView& name)
{
const auto e = Actions.TryGet(name);
if (e != nullptr)
{
return e->Phase;
}
return InputActionPhase::None;
return InputActionState::None;
}
float Input::GetAxis(const StringView& name)
@@ -818,7 +818,7 @@ void InputService::Update()
ActionData& data = Actions[name];
data.Active = false;
data.Phase = InputActionPhase::Waiting;
data.Phase = InputActionState::Waiting;
// Mark as updated in this frame
data.FrameIndex = frame;
@@ -845,15 +845,15 @@ void InputService::Update()
if (Input::GetKeyDown(config.Key) || Input::GetMouseButtonDown(config.MouseButton) || Input::GetGamepadButtonDown(config.Gamepad, config.GamepadButton))
{
data.Phase = InputActionPhase::Press;
data.Phase = InputActionState::Press;
}
else if (Input::GetKey(config.Key) || Input::GetMouseButton(config.MouseButton) || Input::GetGamepadButton(config.Gamepad, config.GamepadButton))
{
data.Phase = InputActionPhase::Pressing;
data.Phase = InputActionState::Pressing;
}
else if (Input::GetKeyUp(config.Key) || Input::GetMouseButtonUp(config.MouseButton) || Input::GetGamepadButtonUp(config.Gamepad, config.GamepadButton))
{
data.Phase = InputActionPhase::Release;
data.Phase = InputActionState::Release;
}
data.Active |= isActive;

View File

@@ -315,7 +315,7 @@ public:
/// <param name="name">The action name.</param>
/// <returns>A InputActionPhase determining the current phase of the Action (e.g If it was just pressed, is being held or just released).</returns>
/// <seealso cref="ActionMappings"/>
API_FUNCTION() static InputActionPhase GetActionPhase(const StringView& name);
API_FUNCTION() static InputActionState GetActionState(const StringView& name);
/// <summary>
/// Gets the value of the virtual axis identified by name. Use <see cref="AxisMappings"/> to get the current config.