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

The structure that defines a point (using floating point values). More...

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

Public Member Functions

constexpr FPoint (const SDL_FPoint &p={})
 Wraps FPoint.
 
constexpr FPoint (float x, float y)
 Constructs from its fields.
 
constexpr bool operator== (const FPoint &other) const
 Default comparison operator.
 
constexpr bool operator== (const SDL_FPoint &p) const
 Compares with the underlying type.
 
constexpr operator bool () const
 Check if valid.
 
constexpr float GetX () const
 Get the x coordinate.
 
constexpr FPointSetX (float newX)
 Set the x coordinate.
 
constexpr float GetY () const
 Get the y coordinate.
 
constexpr FPointSetY (float newY)
 Set the y coordinate.
 
constexpr bool IsInRect (const FRect &r) const
 Determine whether a point resides inside a floating point rectangle.
 
constexpr FPoint operator- () const
 Get point's memberwise negation.
 
constexpr FPoint operator+ (const FPoint &other) const
 Get point's memberwise addition with another point.
 
constexpr FPoint operator- (const FPoint &other) const
 Get point's memberwise subtraction with another point.
 
constexpr FPoint operator/ (float value) const
 Get point's memberwise division by an float.
 
constexpr FPoint operator/ (const FPoint &other) const
 Get point's memberwise division by another point.
 
constexpr FPoint operator* (float value) const
 Get point's memberwise multiplication by an float.
 
constexpr FPoint operator* (const FPoint &other) const
 Get point's memberwise multiplication by another point.
 
constexpr FPointoperator+= (const FPoint &other)
 Memberwise add another point.
 
constexpr FPointoperator-= (const FPoint &other)
 Memberwise subtract another point.
 
constexpr FPointoperator/= (float value)
 Memberwise divide by an float.
 
constexpr FPointoperator/= (const FPoint &other)
 Memberwise divide by another point.
 
constexpr FPointoperator*= (float value)
 Memberwise multiply by an float.
 
constexpr FPointoperator*= (const FPoint &other)
 Memberwise multiply by another point.
 
constexpr FPoint GetClamped (const FRect &rect) const
 Get a point with coordinates modified so it fits into a given rect.
 
constexpr FPointClamp (const FRect &rect)
 Clamp point coordinates to make it fit into a given rect.
 
constexpr FPoint GetWrapped (const FRect &rect) const
 Get a point wrapped within a specified rect.
 
constexpr FPointWrap (const FRect &rect)
 Wrap point coordinates within a specified rect.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ FPoint() [1/2]

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

◆ FPoint() [2/2]

constexpr SDL::FPoint::FPoint ( float  x,
float  y 
)
inlineconstexpr
Parameters
xthe value for x.
ythe value for y.

Member Function Documentation

◆ Clamp()

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

◆ GetClamped()

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

◆ GetWrapped()

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

◆ GetX()

constexpr float SDL::FPoint::GetX ( ) const
inlineconstexpr
Returns
current x value.

◆ GetY()

constexpr float SDL::FPoint::GetY ( ) const
inlineconstexpr
Returns
current y coordinate.

◆ operator bool()

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

◆ operator*() [1/2]

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

◆ operator*() [2/2]

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

◆ operator*=() [1/2]

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

◆ operator*=() [2/2]

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

◆ operator+()

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

◆ operator+=()

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

◆ operator-() [1/2]

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

◆ operator-() [2/2]

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

◆ operator-=()

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

◆ operator/() [1/2]

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

◆ operator/() [2/2]

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

◆ operator/=() [1/2]

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

◆ operator/=() [2/2]

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

◆ SetX()

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

◆ SetY()

constexpr FPoint & SDL::FPoint::SetY ( float  newY)
inlineconstexpr
Parameters
newYthe new y coordinate.
Returns
Reference to self.

◆ Wrap()

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

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