libSDL2pp
C++ bindings/wrapper for SDL2
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL2pp::Point Class Reference

2D point More...

#include <SDL2pp/Point.hh>

Inheritance diagram for SDL2pp::Point:

Public Member Functions

constexpr Point ()
 Default constructor.
 
constexpr Point (const SDL_Point &point)
 Construct a point from existing SDL_Point.
 
constexpr Point (int x, int y)
 Construct the point from given coordinates.
 
 Point (const Point &) noexcept=default
 Copy constructor.
 
 Point (Point &&) noexcept=default
 Move constructor.
 
Pointoperator= (const Point &) noexcept=default
 Assignment operator.
 
Pointoperator= (Point &&) noexcept=default
 Move assignment operator.
 
constexpr int GetX () const
 Get X coordinate of the point.
 
PointSetX (int nx)
 Set X coordinate of the point.
 
constexpr int GetY () const
 Get Y coordinate of the point.
 
PointSetY (int ny)
 Set Y coordinate of the point.
 
constexpr Point operator- () const
 Get point's memberwise negation.
 
constexpr Point operator+ (const Point &other) const
 Get point's memberwise addition with another point.
 
constexpr Point operator- (const Point &other) const
 Get point's memberwise subtraction with another point.
 
constexpr Point operator/ (int value) const
 Get point's memberwise division by an integer.
 
constexpr Point operator/ (const Point &other) const
 Get point's memberwise division by another point.
 
constexpr Point operator% (int value) const
 Get point's memberwise remainder from division by an integer.
 
constexpr Point operator% (const Point &other) const
 Get point's memberwise remainder from division by another point.
 
constexpr Point operator* (int value) const
 Get point's memberwise multiplication by an integer.
 
constexpr Point operator* (const Point &other) const
 Get point's memberwise multiplication by anoter point.
 
Pointoperator+= (const Point &other)
 Memberwise add another point.
 
Pointoperator-= (const Point &other)
 Memberwise subtract another point.
 
Pointoperator/= (int value)
 Memberwise divide by an integer.
 
Pointoperator/= (const Point &other)
 
Pointoperator%= (int value)
 Memberwise remainder from division by an integer.
 
Pointoperator%= (const Point &other)
 Memberwise remainder from division by another point.
 
Pointoperator*= (int value)
 Memberwise multiply by an integer.
 
Pointoperator*= (const Point &other)
 Memberwise multiply by another point.
 
Point GetClamped (const Rect &rect) const
 Get a point with coordinates modified so it fits into a given rect.
 
PointClamp (const Rect &rect)
 Clamp point coordinates to make it fit into a given rect.
 
Point GetWrapped (const Rect &rect) const
 Get a point wrapped within a specified rect.
 
PointWrap (const Rect &rect)
 Wrap point coordinates within a spedified rect.
 

Detailed Description

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.

See also
http://wiki.libsdl.org/SDL_Point

Constructor & Destructor Documentation

◆ Point() [1/5]

constexpr SDL2pp::Point::Point ( )
inlineconstexpr

Default constructor.

Creates a Point(0, 0)

◆ Point() [2/5]

constexpr SDL2pp::Point::Point ( const SDL_Point &  point)
inlineconstexpr

Construct a point from existing SDL_Point.

Parameters
[in]pointExisting SDL_Point

◆ Point() [3/5]

constexpr SDL2pp::Point::Point ( int  x,
int  y 
)
inlineconstexpr

Construct the point from given coordinates.

Parameters
[in]xX coordinate
[in]yY coordinate

◆ Point() [4/5]

SDL2pp::Point::Point ( const Point )
defaultnoexcept

Copy constructor.

◆ Point() [5/5]

SDL2pp::Point::Point ( Point &&  )
defaultnoexcept

Move constructor.

Member Function Documentation

◆ Clamp()

Point & SDL2pp::Point::Clamp ( const Rect rect)

Clamp point coordinates to make it fit into a given rect.

Parameters
[in]rectRectangle to clamp with
Returns
Reference to self

◆ GetClamped()

Point SDL2pp::Point::GetClamped ( const Rect rect) const

Get a point with coordinates modified so it fits into a given rect.

Parameters
[in]rectRectangle to clamp with
Returns
Clamped point

◆ GetWrapped()

Point SDL2pp::Point::GetWrapped ( const Rect rect) const

Get a point wrapped within a specified rect.

Parameters
[in]rectRectangle to wrap with
Returns
Wrapped point

◆ GetX()

constexpr int SDL2pp::Point::GetX ( ) const
inlineconstexpr

Get X coordinate of the point.

Returns
X coordinate of the point

◆ GetY()

constexpr int SDL2pp::Point::GetY ( ) const
inlineconstexpr

Get Y coordinate of the point.

Returns
Y coordinate of the point

◆ operator%() [1/2]

constexpr Point SDL2pp::Point::operator% ( const Point other) const
inlineconstexpr

Get point's memberwise remainder from division by another point.

Parameters
[in]otherDivisor
Returns
New Point representing memberwise remainder from division by another point

◆ operator%() [2/2]

constexpr Point SDL2pp::Point::operator% ( int  value) const
inlineconstexpr

Get point's memberwise remainder from division by an integer.

Parameters
[in]valueDivisor
Returns
New Point representing memberwise remainder from division by an integer

◆ operator%=() [1/2]

Point & SDL2pp::Point::operator%= ( const Point other)
inline

Memberwise remainder from division by another point.

Parameters
[in]otherDivisor
Returns
Reference to self

◆ operator%=() [2/2]

Point & SDL2pp::Point::operator%= ( int  value)
inline

Memberwise remainder from division by an integer.

Parameters
[in]valueDivisor
Returns
Reference to self

◆ operator*() [1/2]

constexpr Point SDL2pp::Point::operator* ( const Point other) const
inlineconstexpr

Get point's memberwise multiplication by anoter point.

Parameters
[in]otherMultiplier
Returns
New Point representing memberwise multiplication of point by another point

◆ operator*() [2/2]

constexpr Point SDL2pp::Point::operator* ( int  value) const
inlineconstexpr

Get point's memberwise multiplication by an integer.

Parameters
[in]valueMultiplier
Returns
New Point representing memberwise multiplication of point by an integer

◆ operator*=() [1/2]

Point & SDL2pp::Point::operator*= ( const Point other)
inline

Memberwise multiply by another point.

Parameters
[in]otherMultiplier
Returns
Reference to self

◆ operator*=() [2/2]

Point & SDL2pp::Point::operator*= ( int  value)
inline

Memberwise multiply by an integer.

Parameters
[in]valueMultiplier
Returns
Reference to self

◆ operator+()

constexpr Point SDL2pp::Point::operator+ ( const Point other) const
inlineconstexpr

Get point's memberwise addition with another point.

Parameters
[in]otherPoint to add
Returns
New Point representing memberwise addition with another point

◆ operator+=()

Point & SDL2pp::Point::operator+= ( const Point other)
inline

Memberwise add another point.

Parameters
[in]otherPoint to add to the current one
Returns
Reference to self

◆ operator-() [1/2]

constexpr Point SDL2pp::Point::operator- ( ) const
inlineconstexpr

Get point's memberwise negation.

Returns
New Point representing memberwise negation

◆ operator-() [2/2]

constexpr Point SDL2pp::Point::operator- ( const Point other) const
inlineconstexpr

Get point's memberwise subtraction with another point.

Parameters
[in]otherPoint to subtract
Returns
New Point representing memberwise subtraction of another point

◆ operator-=()

Point & SDL2pp::Point::operator-= ( const Point other)
inline

Memberwise subtract another point.

Parameters
[in]otherPoint to subtract from the current one
Returns
Reference to self

◆ operator/() [1/2]

constexpr Point SDL2pp::Point::operator/ ( const Point other) const
inlineconstexpr

Get point's memberwise division by another point.

Parameters
[in]otherDivisor
Returns
New Point representing memberwise division of point by another point

◆ operator/() [2/2]

constexpr Point SDL2pp::Point::operator/ ( int  value) const
inlineconstexpr

Get point's memberwise division by an integer.

Parameters
[in]valueDivisor
Returns
New Point representing memberwise division of point by an integer

◆ operator/=() [1/2]

Point & SDL2pp::Point::operator/= ( const Point other)
inline

nbrief Memberwise divide by another point

Parameters
[in]otherDivisor
Returns
Reference to self

◆ operator/=() [2/2]

Point & SDL2pp::Point::operator/= ( int  value)
inline

Memberwise divide by an integer.

Parameters
[in]valueDivisor
Returns
Reference to self

◆ operator=() [1/2]

Point & SDL2pp::Point::operator= ( const Point )
defaultnoexcept

Assignment operator.

Returns
Reference to self

◆ operator=() [2/2]

Point & SDL2pp::Point::operator= ( Point &&  )
defaultnoexcept

Move assignment operator.

Returns
Reference to self

◆ SetX()

Point & SDL2pp::Point::SetX ( int  nx)
inline

Set X coordinate of the point.

Parameters
[in]nxNew X coordinate value
Returns
Reference to self

◆ SetY()

Point & SDL2pp::Point::SetY ( int  ny)
inline

Set Y coordinate of the point.

Parameters
[in]nyNew Y coordinate value
Returns
Reference to self

◆ Wrap()

Point & SDL2pp::Point::Wrap ( const Rect rect)

Wrap point coordinates within a spedified rect.

Parameters
[in]rectRectangle to wrap with
Returns
Reference to self

The documentation for this class was generated from the following files: