summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2010-05-23 22:09:43 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2010-05-23 22:09:43 +0200
commit9620ed1c2c0c40400b638743b19462dfdc6b0c55 (patch)
treec8f26b67de04757ff07b597b48949aee906f31dd /engine
parentf1e9c6d19ef8a2b95f2b77103e02371c89d05188 (diff)
Added Vector2::operator+=.
Diffstat (limited to 'engine')
-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 {