mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-11-22 00:48:09 +01:00
Removed Vector2i(Vector2) constructor, added a Vector2i conversion operator to Vector2 instead. This solves ambigous Variant to Vector2i conversion errors.
This commit is contained in:
parent
2e45ffc5ea
commit
27b73fa9f9
@ -32,6 +32,7 @@
|
||||
#include "vector2.h"
|
||||
|
||||
#include "core/string/ustring.h"
|
||||
#include "vector2i.h"
|
||||
|
||||
real_t Vector2::angle() const {
|
||||
return Math::atan2(y, x);
|
||||
@ -173,4 +174,8 @@ bool Vector2::is_equal_approx(const Vector2 &p_v) const {
|
||||
|
||||
Vector2::operator String() const {
|
||||
return "(" + String::num_real(x) + ", " + String::num_real(y) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
Vector2::operator Vector2i() const {
|
||||
return Vector2i(x, y);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "core/error/error_macros.h"
|
||||
|
||||
class String;
|
||||
struct Vector2i;
|
||||
|
||||
struct _NO_DISCARD_CLASS_ Vector2 {
|
||||
static const int AXIS_COUNT = 2;
|
||||
@ -180,6 +181,7 @@ struct _NO_DISCARD_CLASS_ Vector2 {
|
||||
real_t aspect() const { return width / height; }
|
||||
|
||||
operator String() const;
|
||||
operator Vector2i() const;
|
||||
|
||||
_FORCE_INLINE_ Vector2(real_t p_x, real_t p_y) {
|
||||
x = p_x;
|
||||
|
@ -129,10 +129,6 @@ struct _NO_DISCARD_CLASS_ Vector2i {
|
||||
operator String() const;
|
||||
operator Vector2() const { return Vector2(x, y); }
|
||||
|
||||
inline Vector2i(const Vector2 &p_vec2) {
|
||||
x = (int)p_vec2.x;
|
||||
y = (int)p_vec2.y;
|
||||
}
|
||||
inline Vector2i(int p_x, int p_y) {
|
||||
x = p_x;
|
||||
y = p_y;
|
||||
|
Loading…
Reference in New Issue
Block a user