Added equality comparison to matrices and vectors.

This commit is contained in:
Michael Kuc
2020-04-11 10:59:30 +01:00
parent 4ea9101210
commit 7b30a72939
4 changed files with 37 additions and 0 deletions

View File

@@ -89,6 +89,25 @@ namespace raylib {
return *this;
}
bool operator==(const Matrix& other) {
return m0 == other.m0
&& m1 == other.m1
&& m2 == other.m2
&& m3 == other.m3
&& m4 == other.m4
&& m5 == other.m5
&& m6 == other.m6
&& m7 == other.m7
&& m8 == other.m8
&& m9 == other.m9
&& m10 == other.m10
&& m11 == other.m11
&& m12 == other.m12
&& m13 == other.m13
&& m14 == other.m14
&& m15 == other.m15;
}
inline Matrix& SetProjection() {
::SetMatrixProjection(*this);
return *this;

View File

@@ -45,6 +45,11 @@ namespace raylib {
return *this;
}
bool operator==(const Vector2& other) {
return x == other.x
&& y == other.y;
}
#ifndef RAYLIB_CPP_NO_MATH
Vector2 Add(const Vector2& vector2) {
return Vector2Add(*this, vector2);

View File

@@ -52,6 +52,12 @@ namespace raylib {
return *this;
}
bool operator==(const Vector3& other) {
return x == other.x
&& y == other.y
&& z == other.z;
}
#ifndef RAYLIB_CPP_NO_MATH
Vector3 Add(const Vector3& vector3) {
return Vector3Add(*this, vector3);

View File

@@ -57,6 +57,13 @@ namespace raylib {
return *this;
}
bool operator==(const Vector4& other) {
return x == other.x
&& y == other.y
&& z == other.z
&& w == other.w;
}
#ifndef RAYLIB_CPP_NO_MATH
Vector4 Multiply(const Vector4& vector4) {
return QuaternionMultiply(*this, vector4);