summaryrefslogtreecommitdiff
path: root/shared_cpp
diff options
context:
space:
mode:
Diffstat (limited to 'shared_cpp')
-rw-r--r--shared_cpp/mathlib.cpp4
-rw-r--r--shared_cpp/mathlib.h3
2 files changed, 7 insertions, 0 deletions
diff --git a/shared_cpp/mathlib.cpp b/shared_cpp/mathlib.cpp
index c9f2e0d..17f9f84 100644
--- a/shared_cpp/mathlib.cpp
+++ b/shared_cpp/mathlib.cpp
@@ -210,6 +210,10 @@ float Vector3::operator [](int index) {
}
}
+void Vector2::operator=(const Vector4& other) {
+ x = other.x;
+ y = other.y;
+}
void Vector3::printDebug(const char* name) {
printf("%s=Vector3(%f, %f, %f)\n", name, x, y, z);
diff --git a/shared_cpp/mathlib.h b/shared_cpp/mathlib.h
index d8a15e7..9722f4f 100644
--- a/shared_cpp/mathlib.h
+++ b/shared_cpp/mathlib.h
@@ -22,6 +22,8 @@
#define DEG_TO_RAD(x) (x * (PI / 180.f))
#define RAD_TO_DEG(x) (x * (180.f / PI))
+struct Vector4;
+
// -- Random
inline float randomFloatBetween(float min, float max) {
@@ -44,6 +46,7 @@ struct Vector2 {
Vector2 operator-(Vector2 other);
Vector2 operator*(float s);
Vector2 operator/(float s);
+ void operator=(const Vector4& other);
float dot(Vector2 other);
float length();
Vector2 normalize();