summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/vector.cpp6
-rw-r--r--engine/vector.h1
2 files changed, 7 insertions, 0 deletions
diff --git a/engine/vector.cpp b/engine/vector.cpp
index 1d243dd..c23466e 100644
--- a/engine/vector.cpp
+++ b/engine/vector.cpp
@@ -20,6 +20,12 @@ Vector2& Vector2::operator=(const Vector2& v) {
return *this;
}
+Vector2& Vector2::operator+=(const Vector2& v) {
+ x += v.x;
+ y += v.y;
+ return *this;
+}
+
Vector3::Vector3() : Vector2() {
z = 0;
}
diff --git a/engine/vector.h b/engine/vector.h
index 179674f..127ca81 100644
--- a/engine/vector.h
+++ b/engine/vector.h
@@ -15,6 +15,7 @@ class Vector2 {
Vector2(const Vector2& v);
Vector2& operator=(const Vector2& v);
+ Vector2& operator+=(const Vector2& v);
};
class Vector3 : public Vector2 {