libSDL2pp
C++11 bindings/wrapper for SDL2
|
2D point More...
#include <SDL2pp/Point.hh>
Public Member Functions | |
constexpr | Point () |
Default constructor. More... | |
constexpr | Point (const SDL_Point &point) |
Construct a point from existing SDL_Point. More... | |
constexpr | Point (int x, int y) |
Construct the point from given coordinates. More... | |
Point (const Point &) noexcept=default | |
Copy constructor. | |
Point (Point &&) noexcept=default | |
Move constructor. | |
Point & | operator= (const Point &) noexcept=default |
Assignment operator. More... | |
Point & | operator= (Point &&) noexcept=default |
Move assignment operator. More... | |
constexpr int | GetX () const |
Get X coordinate of the point. More... | |
Point & | SetX (int nx) |
Set X coordinate of the point. More... | |
constexpr int | GetY () const |
Get Y coordinate of the point. More... | |
Point & | SetY (int ny) |
Set Y coordinate of the point. More... | |
constexpr Point | operator- () const |
Get point's memberwise negation. More... | |
constexpr Point | operator+ (const Point &other) const |
Get point's memberwise addition with another point. More... | |
constexpr Point | operator- (const Point &other) const |
Get point's memberwise subtraction with another point. More... | |
constexpr Point | operator/ (int value) const |
Get point's memberwise division by an integer. More... | |
constexpr Point | operator/ (const Point &other) const |
Get point's memberwise division by another point. More... | |
constexpr Point | operator% (int value) const |
Get point's memberwise remainder from division by an integer. More... | |
constexpr Point | operator% (const Point &other) const |
Get point's memberwise remainder from division by another point. More... | |
constexpr Point | operator* (int value) const |
Get point's memberwise multiplication by an integer. More... | |
constexpr Point | operator* (const Point &other) const |
Get point's memberwise multiplication by anoter point. More... | |
Point & | operator+= (const Point &other) |
Memberwise add another point. More... | |
Point & | operator-= (const Point &other) |
Memberwise subtract another point. More... | |
Point & | operator/= (int value) |
Memberwise divide by an integer. More... | |
Point & | operator/= (const Point &other) |
Point & | operator%= (int value) |
Memberwise remainder from division by an integer. More... | |
Point & | operator%= (const Point &other) |
Memberwise remainder from division by another point. More... | |
Point & | operator*= (int value) |
Memberwise multiply by an integer. More... | |
Point & | operator*= (const Point &other) |
Memberwise multiply by another point. More... | |
Point | GetClamped (const Rect &rect) const |
Get a point with coordinates modified so it fits into a given rect. More... | |
Point & | Clamp (const Rect &rect) |
Clamp point coordinates to make it fit into a given rect. More... | |
Point | GetWrapped (const Rect &rect) const |
Get a point wrapped within a specified rect. More... | |
Point & | Wrap (const Rect &rect) |
Wrap point coordinates within a spedified rect. More... | |
2D point
This class is public-derived from SDL_Point structure, may generally used as it if passed via pointer or reference. It also supports direct access to x and y members.
|
inlineconstexpr |
Default constructor.
Creates a Point(0, 0)
|
inlineconstexpr |
Construct a point from existing SDL_Point.
[in] | point | Existing SDL_Point |
|
inlineconstexpr |
Construct the point from given coordinates.
[in] | x | X coordinate |
[in] | y | Y coordinate |
Clamp point coordinates to make it fit into a given rect.
[in] | rect | Rectangle to clamp with |
Get a point with coordinates modified so it fits into a given rect.
[in] | rect | Rectangle to clamp with |
Get a point wrapped within a specified rect.
[in] | rect | Rectangle to wrap with |
|
inlineconstexpr |
Get X coordinate of the point.
|
inlineconstexpr |
Get Y coordinate of the point.
Get point's memberwise remainder from division by another point.
[in] | other | Divisor |
|
inlineconstexpr |
Get point's memberwise remainder from division by an integer.
[in] | value | Divisor |
Memberwise remainder from division by another point.
[in] | other | Divisor |
|
inline |
Memberwise remainder from division by an integer.
[in] | value | Divisor |
Get point's memberwise multiplication by anoter point.
[in] | other | Multiplier |
|
inlineconstexpr |
Get point's memberwise multiplication by an integer.
[in] | value | Multiplier |
Memberwise multiply by another point.
[in] | other | Multiplier |
|
inline |
Memberwise multiply by an integer.
[in] | value | Multiplier |
Memberwise add another point.
[in] | other | Point to add to the current one |
|
inlineconstexpr |
Get point's memberwise negation.
Memberwise subtract another point.
[in] | other | Point to subtract from the current one |
Get point's memberwise division by another point.
[in] | other | Divisor |
|
inlineconstexpr |
Get point's memberwise division by an integer.
[in] | value | Divisor |
nbrief Memberwise divide by another point
[in] | other | Divisor |
|
inline |
Memberwise divide by an integer.
[in] | value | Divisor |
Assignment operator.
Move assignment operator.
|
inline |
Set X coordinate of the point.
[in] | nx | New X coordinate value |
|
inline |
Set Y coordinate of the point.
[in] | ny | New Y coordinate value |
Wrap point coordinates within a spedified rect.
[in] | rect | Rectangle to wrap with |