Collision reworked into a Collision Namespace

Added basic player (Needs work)
This commit is contained in:
Bram Verhulst
2024-03-13 01:09:12 +01:00
parent d0781db9f0
commit d6c5cfa47b
12 changed files with 308 additions and 67 deletions

View File

@@ -23,6 +23,9 @@ Point2f::Point2f(float x, float y)
Point2f Point2f::operator+(const Point2f& other) const {
return Point2f { x + other.x, y + other.y };
}
Point2f Point2f::operator+=(const Point2f& other) const {
return Point2f { x + other.x, y + other.y };
}
Point2f Point2f::operator*(float other) const {
return Point2f { x * other, y * other };
}
@@ -35,11 +38,20 @@ Point2f Point2f::operator*(int other) const {
Point2f Point2f::operator/(float other) const {
return Point2f { x / other, y / other };
}
Point2f Point2f::operator-(const Point2f& other) const {
return Point2f { x - other.x, y - other.y };
}
// Point2f::Point2f(int x, int y)
// : x { (float)x }, y { (float)y } {
// }
Point2f operator/(float right, const Point2f& left) {
return Point2f { right / left.x, right / left.y };
}
Point2f operator*(float right, const Point2f& left) {
return Point2f{ right * left.x, right * left.y };
}
//-----------------------------------------------------------------
// Rectf Constructors
//-----------------------------------------------------------------