change IsAnyKeyDown to IsAnyButtonDown and add Float2.Normalized

This commit is contained in:
Ruan Lucas
2023-01-26 08:54:15 -04:00
parent d20bce9967
commit 82e9923be3
5 changed files with 18 additions and 5 deletions

View File

@@ -267,6 +267,19 @@ namespace FlaxEngine
/// <remarks>This method may be preferred to <see cref="Float2.Length" /> when only a relative length is needed and speed is of the essence.</remarks>
public float LengthSquared => X * X + Y * Y;
/// <summary>
/// Gets the normalized vector. Returned vector has length equal 1.
/// </summary>
public Float2 Normalized
{
get
{
Float2 result = this;
result.Normalize();
return result;
}
}
/// <summary>
/// Converts the vector into a unit vector.
/// </summary>

View File

@@ -31,7 +31,7 @@ void Gamepad::ResetState()
_mappedPrevState.Clear();
}
bool Gamepad::IsAnyKeyDown() const
bool Gamepad::IsAnyButtonDown() const
{
// TODO: optimize with SIMD
bool result = false;

View File

@@ -167,7 +167,7 @@ public:
/// <summary>
/// Checks if any gamepad button is currently pressed.
/// </summary>
API_PROPERTY() bool IsAnyKeyDown() const;
API_PROPERTY() bool IsAnyButtonDown() const;
/// <summary>
/// Gets the gamepad button up state (true if was released during the current frame).

View File

@@ -183,7 +183,7 @@ void Mouse::OnMouseDown(const Float2& position, const MouseButton button, Window
e.MouseData.Position = position;
}
bool Mouse::IsAnyKeyDown() const
bool Mouse::IsAnyButtonDown() const
{
// TODO: optimize with SIMD
bool result = false;

View File

@@ -65,9 +65,9 @@ public:
}
/// <summary>
/// Checks if any mouse key is currently pressed.
/// Checks if any mouse button is currently pressed.
/// </summary>
API_PROPERTY() bool IsAnyKeyDown() const;
API_PROPERTY() bool IsAnyButtonDown() const;
/// <summary>
/// Gets the delta position of the mouse in the screen-space coordinates.