From 306d163613c6940e73ad58e852b42cdb236a5bc4 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Sat, 23 Apr 2022 14:40:51 +0200 Subject: return const refs + vec constantize --- src/helpers/Vector2D.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/helpers/Vector2D.hpp') diff --git a/src/helpers/Vector2D.hpp b/src/helpers/Vector2D.hpp index 5fe4ccd3..7288a088 100644 --- a/src/helpers/Vector2D.hpp +++ b/src/helpers/Vector2D.hpp @@ -14,24 +14,24 @@ class Vector2D { // returns the scale double normalize(); - Vector2D operator+(const Vector2D a) { + Vector2D operator+(const Vector2D a) const { return Vector2D(this->x + a.x, this->y + a.y); } - Vector2D operator-(const Vector2D a) { + Vector2D operator-(const Vector2D a) const { return Vector2D(this->x - a.x, this->y - a.y); } - Vector2D operator*(const float a) { + Vector2D operator*(const float a) const { return Vector2D(this->x * a, this->y * a); } - Vector2D operator/(const float a) { + Vector2D operator/(const float a) const { return Vector2D(this->x / a, this->y / a); } - bool operator==(const Vector2D& a) { + bool operator==(const Vector2D& a) const { return a.x == x && a.y == y; } - bool operator!=(const Vector2D& a) { + bool operator!=(const Vector2D& a) const { return a.x != x || a.y != y; } -- cgit v1.2.3