diff options
Diffstat (limited to 'core/math/vector2.h')
-rw-r--r-- | core/math/vector2.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/core/math/vector2.h b/core/math/vector2.h index c0057f2543..5a3e6a0660 100644 --- a/core/math/vector2.h +++ b/core/math/vector2.h @@ -44,11 +44,11 @@ struct Vector2 { }; union { - real_t x; + real_t x = 0; real_t width; }; union { - real_t y; + real_t y = 0; real_t height; }; @@ -142,11 +142,11 @@ struct Vector2 { operator String() const { return String::num(x) + ", " + String::num(y); } + _FORCE_INLINE_ Vector2() {} _FORCE_INLINE_ Vector2(real_t p_x, real_t p_y) { x = p_x; y = p_y; } - _FORCE_INLINE_ Vector2() { x = y = 0; } }; _FORCE_INLINE_ Vector2 Vector2::plane_project(real_t p_d, const Vector2 &p_vec) const { @@ -260,11 +260,11 @@ struct Vector2i { }; union { - int x; + int x = 0; int width; }; union { - int y; + int y = 0; int height; }; @@ -307,6 +307,8 @@ struct Vector2i { operator String() const { return String::num(x) + ", " + String::num(y); } operator Vector2() const { return Vector2(x, y); } + + inline Vector2i() {} inline Vector2i(const Vector2 &p_vec2) { x = (int)p_vec2.x; y = (int)p_vec2.y; @@ -315,10 +317,6 @@ struct Vector2i { x = p_x; y = p_y; } - inline Vector2i() { - x = 0; - y = 0; - } }; typedef Vector2i Size2i; |