GIGA REFACTOR
This commit is contained in:
@@ -13,14 +13,14 @@ public:
|
||||
Point() : m_X(0), m_Y(0) {}
|
||||
Point(float x, float y) : m_X(x), m_Y(y) {}
|
||||
|
||||
float getX() const { return m_X; }
|
||||
float getY() const { return m_Y; }
|
||||
float GetX() const { return m_X; }
|
||||
float GetY() const { return m_Y; }
|
||||
|
||||
void setX(float x) { m_X = x; }
|
||||
void setY(float y) { m_Y = y; }
|
||||
void SetX(float x) { m_X = x; }
|
||||
void SetY(float y) { m_Y = y; }
|
||||
|
||||
float distance(const Point& point) const;
|
||||
float distanceSquared(const Point& point) const;
|
||||
float Distance(const Point& point) const;
|
||||
float DistanceSquared(const Point& point) const;
|
||||
};
|
||||
|
||||
class Circle;
|
||||
@@ -32,34 +32,34 @@ private:
|
||||
public:
|
||||
Rectangle() {}
|
||||
|
||||
const Point& getCenter() const { return m_Center; }
|
||||
float getCenterX() const { return m_Center.getX(); }
|
||||
float getCenterY() const { return m_Center.getY(); }
|
||||
const Point& GetCenter() const { return m_Center; }
|
||||
float GetCenterX() const { return m_Center.GetX(); }
|
||||
float GetCenterY() const { return m_Center.GetY(); }
|
||||
|
||||
float getWidth() const { return m_Width; }
|
||||
float getHeight() const { return m_Height; }
|
||||
float GetWidth() const { return m_Width; }
|
||||
float GetHeight() const { return m_Height; }
|
||||
|
||||
Point getTopLeft() const { return { m_Center.getX() - (m_Width / 2.0f), m_Center.getY() - (m_Height / 2.0f) }; }
|
||||
Point getBottomRight() const { return { m_Center.getX() + (m_Width / 2.0f), m_Center.getY() + (m_Height / 2.0f) }; }
|
||||
Point GetTopLeft() const { return { m_Center.GetX() - (m_Width / 2.0f), m_Center.GetY() - (m_Height / 2.0f) }; }
|
||||
Point GetBottomRight() const { return { m_Center.GetX() + (m_Width / 2.0f), m_Center.GetY() + (m_Height / 2.0f) }; }
|
||||
|
||||
void setCenter(const Point& center) { m_Center = center; }
|
||||
void setCenterX(float x) { m_Center.setX(x); }
|
||||
void setCenterY(float y) { m_Center.setY(y); }
|
||||
void SetCenter(const Point& center) { m_Center = center; }
|
||||
void SetCenterX(float x) { m_Center.SetX(x); }
|
||||
void SetCenterY(float y) { m_Center.SetY(y); }
|
||||
|
||||
void setSize(float width, float height) { setWidth(width); setHeight(height); }
|
||||
void setSize(Point size) { setSize(size.getX(), size.getY()); }
|
||||
Point getSize() { return { m_Width, m_Height }; }
|
||||
void SetSize(float width, float height) { SetWidth(width); SetHeight(height); }
|
||||
void SetSize(Point size) { SetSize(size.GetX(), size.GetY()); }
|
||||
Point GetSize() { return { m_Width, m_Height }; }
|
||||
|
||||
void setWidth(float width) { m_Width = width; }
|
||||
void setHeight(float height) { m_Height = height; }
|
||||
void SetWidth(float width) { m_Width = width; }
|
||||
void SetHeight(float height) { m_Height = height; }
|
||||
|
||||
bool collidesWith(const Point& point) const;
|
||||
bool collidesWith(const Rectangle& rect) const;
|
||||
bool collidesWith(const Circle& circle) const;
|
||||
bool CollidesWith(const Point& point) const;
|
||||
bool CollidesWith(const Rectangle& rect) const;
|
||||
bool CollidesWith(const Circle& circle) const;
|
||||
|
||||
// distance from the closest side of the rectangle
|
||||
float distance(const Circle& circle) const;
|
||||
float distanceSquared(const Circle& circle) const;
|
||||
float Distance(const Circle& circle) const;
|
||||
float DistanceSquared(const Circle& circle) const;
|
||||
};
|
||||
|
||||
class Circle {
|
||||
@@ -70,25 +70,25 @@ public:
|
||||
Circle(float x, float y, float radius) : m_Center(x, y), m_Radius(radius) {}
|
||||
Circle() : m_Radius(0) {}
|
||||
|
||||
const Point& getCenter() const { return m_Center; }
|
||||
float getCenterX() const { return m_Center.getX(); }
|
||||
float getCenterY() const { return m_Center.getY(); }
|
||||
const Point& GetCenter() const { return m_Center; }
|
||||
float GetCenterX() const { return m_Center.GetX(); }
|
||||
float GetCenterY() const { return m_Center.GetY(); }
|
||||
|
||||
float getRadius() const { return m_Radius; }
|
||||
float GetRadius() const { return m_Radius; }
|
||||
|
||||
void setCenter(const Point& center) { m_Center = center; }
|
||||
void setCenterX(float x) { m_Center.setX(x); }
|
||||
void setCenterY(float y) { m_Center.setY(y); }
|
||||
void SetCenter(const Point& center) { m_Center = center; }
|
||||
void SetCenterX(float x) { m_Center.SetX(x); }
|
||||
void SetCenterY(float y) { m_Center.SetY(y); }
|
||||
|
||||
void setRadius(float radius) { m_Radius = radius; }
|
||||
void SetRadius(float radius) { m_Radius = radius; }
|
||||
|
||||
bool collidesWith(const Point& point) const;
|
||||
bool collidesWith(const Rectangle& rect) const;
|
||||
bool collidesWith(const Circle& circle) const;
|
||||
bool CollidesWith(const Point& point) const;
|
||||
bool CollidesWith(const Rectangle& rect) const;
|
||||
bool CollidesWith(const Circle& circle) const;
|
||||
|
||||
// distance from the closest side of the rectangle
|
||||
float distance(const Rectangle& rect) const;
|
||||
float distanceSquared(const Rectangle& rect) const;
|
||||
float Distance(const Rectangle& rect) const;
|
||||
float DistanceSquared(const Rectangle& rect) const;
|
||||
};
|
||||
|
||||
} // namespace shape
|
||||
|
||||
Reference in New Issue
Block a user