mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00
Add unary minus operator for Point
This commit is contained in:
parent
1001bf8fa2
commit
47f0263ca3
@ -66,6 +66,10 @@ Point& Point::SetY(int ny) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
Point Point::operator-() const {
|
||||
return Point(-x, -y);
|
||||
}
|
||||
|
||||
Point Point::operator+(const Point& other) const {
|
||||
return Point(x + other.x, y + other.y);
|
||||
}
|
||||
|
@ -156,6 +156,14 @@ public:
|
||||
////////////////////////////////////////////////////////////
|
||||
Point& SetY(int ny);
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get point's memberwise negation
|
||||
///
|
||||
/// \returns New Point representing memberwise negation
|
||||
///
|
||||
////////////////////////////////////////////////////////////
|
||||
Point operator-() const;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// \brief Get point's memberwise addition with another point
|
||||
///
|
||||
|
Loading…
x
Reference in New Issue
Block a user