#ifndef VECTOR2_H #define VECTOR2_H #if defined(_WIN32) # ifdef _GD_CPP_CORE_API_IMPL # define GD_CPP_CORE_API __declspec(dllexport) # else # define GD_CPP_CORE_API __declspec(dllimport) # endif #else # define GD_CPP_CORE_API #endif #include #include "Defs.hpp" namespace godot { class String; struct GD_CPP_CORE_API 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