From bad78945ceba425f6a80e3b8dca2414d592970eb Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 2 Aug 2019 20:51:00 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=90=8D=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/modules/asura-utils/Math/Vector2.hpp | 72 +++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 source/modules/asura-utils/Math/Vector2.hpp (limited to 'source/modules/asura-utils/Math/Vector2.hpp') diff --git a/source/modules/asura-utils/Math/Vector2.hpp b/source/modules/asura-utils/Math/Vector2.hpp new file mode 100644 index 0000000..f2405eb --- /dev/null +++ b/source/modules/asura-utils/Math/Vector2.hpp @@ -0,0 +1,72 @@ +#ifndef _ASURA_ENGINE_VECTOR2_H__ +#define _ASURA_ENGINE_VECTOR2_H__ + +namespace AsuraEngine +{ + namespace Math + { + template + class Vector2 + { + public: + Vector2(); + Vector2(T X, T Y); + + template + explicit Vector2(const Vector2& vector); + + void Set(T X, T Y); + + T x; ///< X coordinate of the vector + T y; ///< Y coordinate of the vector + }; + + template + Vector2 operator -(const Vector2& right); + + template + Vector2& operator +=(Vector2& left, const Vector2& right); + + template + Vector2& operator -=(Vector2& left, const Vector2& right); + + template + Vector2 operator +(const Vector2& left, const Vector2& right); + + template + Vector2 operator -(const Vector2& left, const Vector2& right); + + template + Vector2 operator *(const Vector2& left, T right); + + template + Vector2 operator *(T left, const Vector2& right); + + template + Vector2& operator *=(Vector2& left, T right); + + template + Vector2 operator /(const Vector2& left, T right); + + template + Vector2& operator /=(Vector2& left, T right); + + template + bool operator ==(const Vector2& left, const Vector2& right); + + template + bool operator !=(const Vector2& left, const Vector2& right); + +#include "Vector2.inc" + + // Define the most common types + typedef Vector2 Vector2i; + typedef Vector2 Vector2u; + typedef Vector2 Vector2f; + + } +} + +namespace AEMath = AsuraEngine::Math; + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0