diff --git a/Source/Engine/Core/Math/Int2.cpp b/Source/Engine/Core/Math/Int2.cpp new file mode 100644 index 000000000..1293d23ac --- /dev/null +++ b/Source/Engine/Core/Math/Int2.cpp @@ -0,0 +1,51 @@ +// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. + +#include "Int2.h" +#include "Int3.h" +#include "Int4.h" +#include "Vector2.h" +#include "Vector3.h" +#include "Vector4.h" +#include "Engine/Core/Types/String.h" + +static_assert(sizeof(Int2) == 8, "Invalid Int2 type size."); + +const Int2 Int2::Zero(0); +const Int2 Int2::One(1); +const Int2 Int2::Minimum(MIN_int32); +const Int2 Int2::Maximum(MAX_int32); + +Int2::Int2(const Int3& xyz) + : X(xyz.X) + , Y(xyz.Y) +{ +} + +Int2::Int2(const Int4& xyzw) + : X(xyzw.X) + , Y(xyzw.Y) +{ +} + +Int2::Int2(const Vector2& xy) + : X(static_cast(xy.X)) + , Y(static_cast(xy.Y)) +{ +} + +Int2::Int2(const Vector3& xyz) + : X(static_cast(xyz.X)) + , Y(static_cast(xyz.Y)) +{ +} + +Int2::Int2(const Vector4& xyzw) + : X(static_cast(xyzw.X)) + , Y(static_cast(xyzw.Y)) +{ +} + +String Int2::ToString() const +{ + return String::Format(TEXT("{}"), *this); +}