mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
75 lines
1.6 KiB
C++
Executable File
75 lines
1.6 KiB
C++
Executable File
#ifndef VECTOR2I_H
|
|
#define VECTOR2I_H
|
|
|
|
#include "core/string.h"
|
|
|
|
class Vector2;
|
|
|
|
class Vector2i {
|
|
public:
|
|
Vector2i abs() const;
|
|
float angle() const;
|
|
float angle_to(const Vector2i &b) const;
|
|
float cross(const Vector2i &b) const;
|
|
float distance_to_squared(const Vector2i &b) const;
|
|
float distance_to(const Vector2i &b) const;
|
|
float dot(const Vector2i &b) const;
|
|
|
|
float length() const;
|
|
float length_squared() const;
|
|
|
|
Vector2i lerp(const Vector2i &b, const float t) const;
|
|
|
|
void add(const Vector2i &b);
|
|
void sub(const Vector2i &b);
|
|
|
|
Vector2i();
|
|
Vector2i(const Vector2i &b);
|
|
Vector2i(const int p_x, const int p_y);
|
|
|
|
Vector2i &operator+=(const Vector2i &b);
|
|
Vector2i operator+(const Vector2i &b) const;
|
|
Vector2i &operator-=(const Vector2i &b);
|
|
Vector2i operator-(const Vector2i &b) const;
|
|
Vector2i &operator*=(const Vector2i &b);
|
|
Vector2i operator*(const Vector2i &b) const;
|
|
Vector2i &operator/=(const Vector2i &b);
|
|
Vector2i operator/(const Vector2i &b) const;
|
|
|
|
Vector2i &operator+=(int scalar);
|
|
Vector2i operator+(int scalar) const;
|
|
Vector2i &operator-=(int scalar);
|
|
Vector2i operator-(int scalar) const;
|
|
Vector2i &operator*=(int scalar);
|
|
Vector2i operator*(int scalar) const;
|
|
Vector2i &operator/=(int scalar);
|
|
Vector2i operator/(int scalar) const;
|
|
|
|
Vector2i operator-() const;
|
|
|
|
bool operator==(const Vector2i &b) const;
|
|
bool operator!=(const Vector2i &b) const;
|
|
|
|
const int &operator[](int axis) const;
|
|
int &operator[](int axis);
|
|
|
|
operator String() const;
|
|
operator Vector2() const;
|
|
|
|
enum Axis {
|
|
AXIS_X = 0,
|
|
AXIS_Y
|
|
};
|
|
|
|
union {
|
|
struct {
|
|
int x;
|
|
int y;
|
|
};
|
|
|
|
int coordinates[2];
|
|
};
|
|
};
|
|
|
|
#endif
|