SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SDL::Point Struct Reference

The structure that defines a point (using integers) More...

Inheritance diagram for SDL::Point:
Inheritance graph
[legend]

Public Member Functions

constexpr Point (const SDL_Point &p={})
 Wraps Point.
 
constexpr Point (int x, int y)
 Constructs from its fields.
 
constexpr Point (const SDL_FPoint &p)
 Explicit conversion from FPoint.
 
constexpr bool operator== (const Point &other) const
 Default comparison operator.
 
constexpr bool operator== (const SDL_Point &p) const
 Compares with the underlying type.
 
constexpr operator bool () const
 Check if valid.
 
constexpr int GetX () const
 Get x coordinate.
 
constexpr PointSetX (int newX)
 Set the x coordinate.
 
constexpr int GetY () const
 Get y coordinate.
 
constexpr PointSetY (int newY)
 Set the y.
 
constexpr bool IsInRect (const Rect &r) const
 Determine whether a point resides inside a rectangle.
 
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 FPoint operator/ (float 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 FPoint operator* (float value) const
 Get point's memberwise multiplication by an integer.
 
constexpr Point operator* (const Point &other) const
 Get point's memberwise multiplication by another point.
 
constexpr Pointoperator+= (const Point &other)
 Memberwise add another point.
 
constexpr Pointoperator-= (const Point &other)
 Memberwise subtract another point.
 
constexpr Pointoperator/= (int value)
 Memberwise divide by an integer.
 
constexpr Pointoperator/= (const Point &other)
 Memberwise divide by another point.
 
constexpr Pointoperator%= (int value)
 Memberwise remainder from division by an integer.
 
constexpr Pointoperator%= (const Point &other)
 Memberwise remainder from division by another point.
 
constexpr Pointoperator*= (int value)
 Memberwise multiply by an integer.
 
constexpr Pointoperator*= (const Point &other)
 Memberwise multiply by another point.
 
constexpr Point GetClamped (const Rect &rect) const
 Get a point with coordinates modified so it fits into a given rect.
 
constexpr PointClamp (const Rect &rect)
 Clamp point coordinates to make it fit into a given rect.
 
constexpr Point GetWrapped (const Rect &rect) const
 Get a point wrapped within a specified rect.
 
constexpr PointWrap (const Rect &rect)
 Wrap point coordinates within a specified rect.
 
constexpr operator FPoint () const
 Converts to FPoint.
 

Detailed Description

Based on https://github.com/libSDL2pp/libSDL2pp/blob/master/SDL2pp/Point.hh

Category:
Wrap extending struct
See also
wrap-extending-struct

Constructor & Destructor Documentation

◆ Point() [1/2]

constexpr SDL::Point::Point ( const SDL_Point &  p = {})
inlineconstexpr
Parameters
pthe value to be wrapped

◆ Point() [2/2]

constexpr SDL::Point::Point ( int  x,
int  y 
)
inlineconstexpr
Parameters
xthe value for x.
ythe value for y.

Member Function Documentation

◆ Clamp()

constexpr Point & SDL::Point::Clamp ( const Rect rect)
constexpr
Parameters
[in]rectRectangle to clamp with
Returns
Reference to self

◆ GetClamped()

constexpr Point SDL::Point::GetClamped ( const Rect rect) const
constexpr
Parameters
[in]rectRectangle to clamp with
Returns
Clamped point

◆ GetWrapped()

constexpr Point SDL::Point::GetWrapped ( const Rect rect) const
constexpr
Parameters
[in]rectRectangle to wrap with
Returns
Wrapped point

◆ GetX()

constexpr int SDL::Point::GetX ( ) const
inlineconstexpr
Returns
x coordinate

◆ GetY()

constexpr int SDL::Point::GetY ( ) const
inlineconstexpr
Returns
y coordinate

◆ operator bool()

constexpr SDL::Point::operator bool ( ) const
inlineexplicitconstexpr
Returns
True if valid state, false otherwise.

◆ operator FPoint()

constexpr SDL::Point::operator FPoint ( ) const
constexpr
Returns
FPoint

◆ operator%() [1/2]

constexpr Point SDL::Point::operator% ( const Point other) const
inlineconstexpr
Parameters
[in]otherDivisor
Returns
New Point representing memberwise remainder from division by another point

◆ operator%() [2/2]

constexpr Point SDL::Point::operator% ( int  value) const
inlineconstexpr
Parameters
[in]valueDivisor
Returns
New Point representing memberwise remainder from division by an integer

◆ operator%=() [1/2]

constexpr Point & SDL::Point::operator%= ( const Point other)
inlineconstexpr
Parameters
[in]otherDivisor
Returns
Reference to self

◆ operator%=() [2/2]

constexpr Point & SDL::Point::operator%= ( int  value)
inlineconstexpr
Parameters
[in]valueDivisor
Returns
Reference to self

◆ operator*() [1/3]

constexpr Point SDL::Point::operator* ( const Point other) const
inlineconstexpr
Parameters
[in]otherMultiplier
Returns
New Point representing memberwise multiplication of point by another point

◆ operator*() [2/3]

constexpr FPoint SDL::Point::operator* ( float  value) const
constexpr
Parameters
[in]valueMultiplier
Returns
New Point representing memberwise multiplication of point by an integer

◆ operator*() [3/3]

constexpr Point SDL::Point::operator* ( int  value) const
inlineconstexpr
Parameters
[in]valueMultiplier
Returns
New Point representing memberwise multiplication of point by an integer

◆ operator*=() [1/2]

constexpr Point & SDL::Point::operator*= ( const Point other)
inlineconstexpr
Parameters
[in]otherMultiplier
Returns
Reference to self

◆ operator*=() [2/2]

constexpr Point & SDL::Point::operator*= ( int  value)
inlineconstexpr
Parameters
[in]valueMultiplier
Returns
Reference to self

◆ operator+()

constexpr Point SDL::Point::operator+ ( const Point other) const
inlineconstexpr
Parameters
[in]otherPoint to add
Returns
New Point representing memberwise addition with another point

◆ operator+=()

constexpr Point & SDL::Point::operator+= ( const Point other)
inlineconstexpr
Parameters
[in]otherPoint to add to the current one
Returns
Reference to self

◆ operator-() [1/2]

constexpr Point SDL::Point::operator- ( ) const
inlineconstexpr
Returns
New Point representing memberwise negation

◆ operator-() [2/2]

constexpr Point SDL::Point::operator- ( const Point other) const
inlineconstexpr
Parameters
[in]otherPoint to subtract
Returns
New Point representing memberwise subtraction of another point

◆ operator-=()

constexpr Point & SDL::Point::operator-= ( const Point other)
inlineconstexpr
Parameters
[in]otherPoint to subtract from the current one
Returns
Reference to self

◆ operator/() [1/3]

constexpr Point SDL::Point::operator/ ( const Point other) const
inlineconstexpr
Parameters
[in]otherDivisor
Returns
New Point representing memberwise division of point by another point

◆ operator/() [2/3]

constexpr FPoint SDL::Point::operator/ ( float  value) const
constexpr
Parameters
[in]valueDivisor
Returns
New Point representing memberwise division of point by an integer

◆ operator/() [3/3]

constexpr Point SDL::Point::operator/ ( int  value) const
inlineconstexpr
Parameters
[in]valueDivisor
Returns
New Point representing memberwise division of point by an integer

◆ operator/=() [1/2]

constexpr Point & SDL::Point::operator/= ( const Point other)
inlineconstexpr
Parameters
[in]otherDivisor
Returns
Reference to self

◆ operator/=() [2/2]

constexpr Point & SDL::Point::operator/= ( int  value)
inlineconstexpr
Parameters
[in]valueDivisor
Returns
Reference to self

◆ SetX()

constexpr Point & SDL::Point::SetX ( int  newX)
inlineconstexpr
Parameters
newXthe new x coordinate.
Returns
Reference to self.

◆ SetY()

constexpr Point & SDL::Point::SetY ( int  newY)
inlineconstexpr
Parameters
newYthe new y value.
Returns
Reference to self.

◆ Wrap()

constexpr Point & SDL::Point::Wrap ( const Rect rect)
constexpr
Parameters
[in]rectRectangle to wrap with
Returns
Reference to self

The documentation for this struct was generated from the following file: