The performance mode, which I'm working on, can now be tested with `make performance && ./performance`. A very simple test was added, and it works!
53 lines
859 B
C++
53 lines
859 B
C++
#pragma once
|
|
|
|
class Point
|
|
{
|
|
private:
|
|
float m_x, m_y;
|
|
|
|
public:
|
|
Point(float x, float y) : m_x(x), m_y(y) {}
|
|
|
|
Point() : m_x(0), m_y(0) {}
|
|
|
|
float x() const
|
|
{
|
|
return m_x;
|
|
}
|
|
|
|
float y() const
|
|
{
|
|
return m_y;
|
|
}
|
|
|
|
Point operator+(const Point &other) const
|
|
{
|
|
return Point(x() + other.x(), y() + other.y());
|
|
}
|
|
|
|
Point operator-(const Point &other) const
|
|
{
|
|
return Point(x() - other.x(), y() - other.y());
|
|
}
|
|
|
|
Point &operator+=(const Point &other)
|
|
{
|
|
m_x += other.x();
|
|
m_y += other.y();
|
|
|
|
return *this;
|
|
}
|
|
|
|
Point &operator-=(const Point &other)
|
|
{
|
|
m_x -= other.x();
|
|
m_y -= other.y();
|
|
|
|
return *this;
|
|
}
|
|
|
|
bool operator==(const Point &other) const
|
|
{
|
|
return (x() == other.x() && y() == other.y());
|
|
}
|
|
}; |