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

308 lines
9.3 KiB
C++
Raw Normal View History

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