1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 16:57:16 +01:00
SqMod/source/Base/Vector2u.hpp

143 lines
7.4 KiB
C++
Raw Normal View History

2015-09-30 02:56:11 +02:00
#ifndef _BASE_VECTOR2U_HPP_
#define _BASE_VECTOR2U_HPP_
// ------------------------------------------------------------------------------------------------
#include "Config.hpp"
// ------------------------------------------------------------------------------------------------
namespace SqMod {
/* ------------------------------------------------------------------------------------------------
* ...
*/
struct Vector2u
{
// --------------------------------------------------------------------------------------------
typedef SQUnsignedInteger32 Value;
// --------------------------------------------------------------------------------------------
static const Vector2u NIL;
static const Vector2u MIN;
static const Vector2u MAX;
// --------------------------------------------------------------------------------------------
static SQChar Delim;
// --------------------------------------------------------------------------------------------
Value x, y;
// --------------------------------------------------------------------------------------------
Vector2u();
Vector2u(Value s);
Vector2u(Value xv, Value yv);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u(const Vector2i & v);
Vector2u(const Vector2f & v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u(const SQChar * values, SQChar delim);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u(const Vector2u & v);
Vector2u(Vector2u && v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
~Vector2u();
// --------------------------------------------------------------------------------------------
Vector2u & operator = (const Vector2u & v);
Vector2u & operator = (Vector2u && v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u & operator = (Value s);
Vector2u & operator = (const SQChar * values);
Vector2u & operator = (const Vector2i & v);
Vector2u & operator = (const Vector2f & v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u & operator += (const Vector2u & v);
Vector2u & operator -= (const Vector2u & v);
Vector2u & operator *= (const Vector2u & v);
Vector2u & operator /= (const Vector2u & v);
Vector2u & operator %= (const Vector2u & v);
Vector2u & operator &= (const Vector2u & v);
Vector2u & operator |= (const Vector2u & v);
Vector2u & operator ^= (const Vector2u & v);
Vector2u & operator <<= (const Vector2u & v);
Vector2u & operator >>= (const Vector2u & v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u & operator += (Value s);
Vector2u & operator -= (Value s);
Vector2u & operator *= (Value s);
Vector2u & operator /= (Value s);
Vector2u & operator %= (Value s);
Vector2u & operator &= (Value s);
Vector2u & operator |= (Value s);
Vector2u & operator ^= (Value s);
Vector2u & operator <<= (Value s);
Vector2u & operator >>= (Value s);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u & operator ++ ();
Vector2u & operator -- ();
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator ++ (int);
Vector2u operator -- (int);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator + (const Vector2u & v) const;
Vector2u operator + (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator - (const Vector2u & v) const;
Vector2u operator - (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator * (const Vector2u & v) const;
Vector2u operator * (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator / (const Vector2u & v) const;
Vector2u operator / (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator % (const Vector2u & v) const;
Vector2u operator % (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator & (const Vector2u & v) const;
Vector2u operator & (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator | (const Vector2u & v) const;
Vector2u operator | (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator ^ (const Vector2u & v) const;
Vector2u operator ^ (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator << (const Vector2u & v) const;
Vector2u operator << (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator >> (const Vector2u & v) const;
Vector2u operator >> (Value s) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator + () const;
Vector2u operator - () const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u operator ~ () const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
bool operator == (const Vector2u & v) const;
bool operator != (const Vector2u & v) const;
bool operator < (const Vector2u & v) const;
bool operator > (const Vector2u & v) const;
bool operator <= (const Vector2u & v) const;
bool operator >= (const Vector2u & v) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
SQInteger Cmp(const Vector2u & v) const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
const SQChar * ToString() const;
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Set(Value ns);
void Set(Value nx, Value ny);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Set(const Vector2u & v);
void Set(const Vector2i & v);
void Set(const Vector2f & v);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Set(const SQChar * values, SQChar delim);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Generate();
void Generate(Value min, Value max);
void Generate(Value xmin, Value xmax, Value ymin, Value ymax);
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
void Clear() { x = 0, y = 0; }
2015-09-30 02:56:11 +02:00
// --------------------------------------------------------------------------------------------
Vector2u Abs() const;
2015-09-30 02:56:11 +02:00
};
} // Namespace:: SqMod
#endif // _BASE_VECTOR2U_HPP_