From 4b4bf833a93fb6d2d28994f1f700b54ed16a9bae Mon Sep 17 00:00:00 2001 From: Olly Rybak Date: Fri, 12 May 2023 00:25:03 +1000 Subject: [PATCH] Rename Phase > State --- Source/Engine/Input/Enums.h | 2 +- Source/Engine/Input/Input.cpp | 16 ++++++++-------- Source/Engine/Input/Input.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Engine/Input/Enums.h b/Source/Engine/Input/Enums.h index 4c96f715f..82498f500 100644 --- a/Source/Engine/Input/Enums.h +++ b/Source/Engine/Input/Enums.h @@ -266,7 +266,7 @@ API_ENUM() enum class InputActionMode /// /// The input action event phases. /// -API_ENUM() enum class InputActionPhase +API_ENUM() enum class InputActionState { /// /// The key/button is not assigned. diff --git a/Source/Engine/Input/Input.cpp b/Source/Engine/Input/Input.cpp index 2f45a4a16..b22efa4fc 100644 --- a/Source/Engine/Input/Input.cpp +++ b/Source/Engine/Input/Input.cpp @@ -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; diff --git a/Source/Engine/Input/Input.h b/Source/Engine/Input/Input.h index 35f3dac32..1fcb352ea 100644 --- a/Source/Engine/Input/Input.h +++ b/Source/Engine/Input/Input.h @@ -315,7 +315,7 @@ public: /// The action name. /// A InputActionPhase determining the current phase of the Action (e.g If it was just pressed, is being held or just released). /// - API_FUNCTION() static InputActionPhase GetActionPhase(const StringView& name); + API_FUNCTION() static InputActionState GetActionState(const StringView& name); /// /// Gets the value of the virtual axis identified by name. Use to get the current config.