#ifndef VECTOR2_H #define VECTOR2_H #include #include "Defs.h" namespace godot { class String; struct Vector2 { union { real_t x; real_t width; }; union { real_t y; real_t height; }; inline real_t& operator[](int p_idx) { return p_idx?y:x; } inline const real_t& operator[](int p_idx) const { return p_idx?y:x; } Vector2 operator+(const Vector2& p_v) const; void operator+=(const Vector2& p_v); Vector2 operator-(const Vector2& p_v) const; void operator-=(const Vector2& p_v); Vector2 operator*(const Vector2 &p_v1) const; Vector2 operator*(const real_t &rvalue) const; void operator*=(const real_t &rvalue); inline void operator*=(const Vector2 &rvalue) { *this = *this * rvalue; } Vector2 operator/(const Vector2 &p_v1) const; Vector2 operator/(const real_t &rvalue) const; void operator/=(const real_t &rvalue); Vector2 operator-() const; bool operator==(const Vector2& p_vec2) const; bool operator!=(const Vector2& p_vec2) const; inline bool operator<(const Vector2& p_vec2) const { return (x==p_vec2.x)?(y