Added comments / reformat
This commit is contained in:
@@ -264,28 +264,34 @@ API_ENUM() enum class InputActionMode
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The input action event trigger modes.
|
||||
/// The input action event phases.
|
||||
/// </summary>
|
||||
API_ENUM() enum class InputActionPhase
|
||||
{
|
||||
/// <summary>
|
||||
/// The key/button is not assigned.
|
||||
/// </summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// The key/button is waiting for input.
|
||||
/// </summary>
|
||||
Waiting = 1,
|
||||
|
||||
/// <summary>
|
||||
/// User is pressing the key/button.
|
||||
/// </summary>
|
||||
Pressing = 0,
|
||||
Pressing = 2,
|
||||
|
||||
/// <summary>
|
||||
/// User pressed the key/button (but wasn't pressing it in the previous frame).
|
||||
/// </summary>
|
||||
Press = 1,
|
||||
Press = 3,
|
||||
|
||||
/// <summary>
|
||||
/// User released the key/button (was pressing it in the previous frame).
|
||||
/// </summary>
|
||||
Release = 2,
|
||||
|
||||
Waiting = 3,
|
||||
|
||||
None = 4,
|
||||
Release = 4,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -25,7 +25,7 @@ struct AxisEvaluation
|
||||
bool Used;
|
||||
};
|
||||
|
||||
struct ActionData
|
||||
struct ActionData
|
||||
{
|
||||
bool Active;
|
||||
uint64 FrameIndex;
|
||||
@@ -35,7 +35,7 @@ struct ActionData
|
||||
{
|
||||
Active = false;
|
||||
FrameIndex = 0;
|
||||
Phase = InputActionPhase::None;
|
||||
Phase = InputActionPhase::Waiting;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -844,11 +844,17 @@ void InputService::Update()
|
||||
}
|
||||
|
||||
if (Input::GetKeyDown(config.Key) || Input::GetMouseButtonDown(config.MouseButton) || Input::GetGamepadButtonDown(config.Gamepad, config.GamepadButton))
|
||||
{
|
||||
data.Phase = InputActionPhase::Press;
|
||||
}
|
||||
else if (Input::GetKey(config.Key) || Input::GetMouseButton(config.MouseButton) || Input::GetGamepadButton(config.Gamepad, config.GamepadButton))
|
||||
{
|
||||
data.Phase = InputActionPhase::Pressing;
|
||||
}
|
||||
else if (Input::GetKeyUp(config.Key) || Input::GetMouseButtonUp(config.MouseButton) || Input::GetGamepadButtonUp(config.Gamepad, config.GamepadButton))
|
||||
{
|
||||
data.Phase = InputActionPhase::Release;
|
||||
}
|
||||
|
||||
data.Active |= isActive;
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ public:
|
||||
/// Gets the value of the virtual action identified by name. Use <see cref="ActionMappings"/> to get the current config.
|
||||
/// </summary>
|
||||
/// <param name="name">The action name.</param>
|
||||
/// <returns>True if action has been triggered in the current frame (e.g. button pressed), otherwise false.</returns>
|
||||
/// <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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user