Fixed warnings and errors in Vector2/3 and GameObject

This commit is contained in:
Kah Wei 2022-09-13 18:37:05 +08:00
parent 32a68d22ae
commit 073cf902a9
5 changed files with 15 additions and 15 deletions

View File

@ -139,8 +139,8 @@ namespace SHADE
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
/* Constructors */ /* Constructors */
/*---------------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------------*/
GameObject::GameObject(EntityID entity) GameObject::GameObject(const SHEntity& entity)
: entity { entity } : entity { entity.GetEID() }
{} {}
GameObject::GameObject(Entity entity) GameObject::GameObject(Entity entity)

View File

@ -207,7 +207,7 @@ namespace SHADE
/// <param name="entity"> /// <param name="entity">
/// The ECS Entity that this GameObject should represent. /// The ECS Entity that this GameObject should represent.
/// </param> /// </param>
GameObject(SHEntity entity); GameObject(const SHEntity& entity);
/// <summary> /// <summary>
/// Constructor for the GameObject. /// Constructor for the GameObject.
/// </summary> /// </summary>

View File

@ -204,11 +204,11 @@ namespace SHADE
return target; return target;
// Calculate new position // Calculate new position
const Vector2 DELTA = (target - current).GetNormalised() * maxDistanceDelta; Vector2 DELTA = (target - current).GetNormalised() * maxDistanceDelta;
Vector2 newPos = current + DELTA; Vector2 newPos = current + DELTA;
// Check if check if is behind or ahead of target // Check if check if is behind or ahead of target
const Vector2 DIFF = target - newPos; Vector2 DIFF = target - newPos;
if (Dot(DELTA, DIFF) < 0.0) if (Dot(DELTA, DIFF) < 0.0)
{ {
newPos = target; newPos = target;

View File

@ -37,37 +37,37 @@ namespace SHADE
///<summary> ///<summary>
/// Shorthand for writing Vector2(0, -1). /// Shorthand for writing Vector2(0, -1).
///</summary> ///</summary>
static const Vector2 Down = Vector2(0.0, -1.0); static Vector2 Down = Vector2(0.0, -1.0);
///<summary> ///<summary>
/// Shorthand for writing Vector2(-1, 0). /// Shorthand for writing Vector2(-1, 0).
///</summary> ///</summary>
static const Vector2 Left = Vector2(-1.0, 0.0); static Vector2 Left = Vector2(-1.0, 0.0);
///<summary> ///<summary>
/// Shorthand for writing Vector2(double.NegativeInfinity, /// Shorthand for writing Vector2(double.NegativeInfinity,
/// double.NegativeInfinity). /// double.NegativeInfinity).
///</summary> ///</summary>
static const Vector2 NegativeInfinity = Vector2(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest()); static Vector2 NegativeInfinity = Vector2(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::lowest());
///<summary> ///<summary>
/// Shorthand for writing Vector2(1, 1). /// Shorthand for writing Vector2(1, 1).
///</summary> ///</summary>
static const Vector2 One = Vector2(1.0, 1.0); static Vector2 One = Vector2(1.0, 1.0);
///<summary> ///<summary>
/// Shorthand for writing Vector2(double.PositiveInfinity, /// Shorthand for writing Vector2(double.PositiveInfinity,
/// double.PositiveInfinity). /// double.PositiveInfinity).
///</summary> ///</summary>
static const Vector2 PositiveInfinity = Vector2(std::numeric_limits<double>::max(), std::numeric_limits<double>::max()); static Vector2 PositiveInfinity = Vector2(std::numeric_limits<double>::max(), std::numeric_limits<double>::max());
///<summary> ///<summary>
/// Shorthand for writing Vector2(1, 0). /// Shorthand for writing Vector2(1, 0).
///</summary> ///</summary>
static const Vector2 Right = Vector2(1.0, 0.0); static Vector2 Right = Vector2(1.0, 0.0);
///<summary> ///<summary>
/// Shorthand for writing Vector2(0, 1). /// Shorthand for writing Vector2(0, 1).
///</summary> ///</summary>
static const Vector2 Up = Vector2(0.0, 1.0); static Vector2 Up = Vector2(0.0, 1.0);
///<summary> ///<summary>
/// Shorthand for writing Vector2(0, 0). /// Shorthand for writing Vector2(0, 0).
///</summary> ///</summary>
static const Vector2 Zero = Vector2(0.0, 0.0); static Vector2 Zero = Vector2(0.0, 0.0);
#pragma endregion #pragma endregion
/*-----------------------------------------------------------------------------*/ /*-----------------------------------------------------------------------------*/

View File

@ -201,11 +201,11 @@ namespace SHADE
return target; return target;
// Calculate new position // Calculate new position
const Vector3 DELTA = (target - current).GetNormalised() * maxDistanceDelta; Vector3 DELTA = (target - current).GetNormalised() * maxDistanceDelta;
Vector3 newPos = current + DELTA; Vector3 newPos = current + DELTA;
// Check if check if is behind or ahead of target // Check if check if is behind or ahead of target
const Vector3 DIFF = target - newPos; Vector3 DIFF = target - newPos;
if (Dot(DELTA, DIFF) < 0.0) if (Dot(DELTA, DIFF) < 0.0)
{ {
newPos = target; newPos = target;