1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 08:47:17 +01:00
SqMod/source/Base/Vector2f.hpp
Sandu Liviu Catalin 6ed02d0fd4 Initial commit.
2015-09-30 03:56:11 +03:00

113 lines
6.1 KiB
C++

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