SDL3pp
A slim C++ wrapper for SDL3
Loading...
Searching...
No Matches
SDL::FPoint Struct Reference

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

Inheritance diagram for SDL::FPoint:
[legend]

Public Member Functions

constexpr FPoint (const FPointRaw &p={}) noexcept
 Wraps FPoint.
constexpr FPoint (float x, float y) noexcept
 Constructs from its fields.
constexpr operator bool () const noexcept
 Check if valid.
constexpr float GetX () const noexcept
 Get the x coordinate.
constexpr FPointSetX (float newX) noexcept
 Set the x coordinate.
constexpr float GetY () const noexcept
 Get the y coordinate.
constexpr FPointSetY (float newY) noexcept
 Set the y coordinate.
bool InRect (const FRectRaw &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

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

Since
This struct is available since SDL 3.2.0.
Category:
Wrap extending struct
See also
FRect.GetEnclosingPoints
FPoint.InRect

Constructor & Destructor Documentation

◆ FPoint() [1/2]

SDL::FPoint::FPoint ( const FPointRaw & p = {})
inlineconstexprnoexcept

Wraps FPoint.

Parameters
pthe value to be wrapped

◆ FPoint() [2/2]

SDL::FPoint::FPoint ( float x,
float y )
inlineconstexprnoexcept

Constructs from its fields.

Parameters
xthe value for x.
ythe value for y.

Member Function Documentation

◆ Clamp()

FPoint & SDL::FPoint::Clamp ( const FRect & rect)
constexpr

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

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

◆ GetClamped()

FPoint SDL::FPoint::GetClamped ( const FRect & rect) const
constexpr

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

Parameters
[in]rectRectangle to clamp with
Returns
Clamped point

◆ GetWrapped()

FPoint SDL::FPoint::GetWrapped ( const FRect & rect) const
constexpr

Get a point wrapped within a specified rect.

Parameters
[in]rectRectangle to wrap with
Returns
Wrapped point

◆ GetX()

float SDL::FPoint::GetX ( ) const
inlineconstexprnoexcept

Get the x coordinate.

Returns
current x value.

◆ GetY()

float SDL::FPoint::GetY ( ) const
inlineconstexprnoexcept

Get the y coordinate.

Returns
current y coordinate.

◆ operator bool()

SDL::FPoint::operator bool ( ) const
inlineexplicitconstexprnoexcept

Check if valid.

Returns
True if valid state, false otherwise.

◆ operator*() [1/2]

FPoint SDL::FPoint::operator* ( const FPoint & other) const
inlineconstexpr

Get point's memberwise multiplication by another point.

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

◆ operator*() [2/2]

FPoint SDL::FPoint::operator* ( float value) const
inlineconstexpr

Get point's memberwise multiplication by an float.

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

◆ operator*=() [1/2]

FPoint & SDL::FPoint::operator*= ( const FPoint & other)
inlineconstexpr

Memberwise multiply by another point.

Parameters
[in]otherMultiplier
Returns
Reference to self

◆ operator*=() [2/2]

FPoint & SDL::FPoint::operator*= ( float value)
inlineconstexpr

Memberwise multiply by an float.

Parameters
[in]valueMultiplier
Returns
Reference to self

◆ operator+()

FPoint SDL::FPoint::operator+ ( const FPoint & 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+=()

FPoint & SDL::FPoint::operator+= ( const FPoint & other)
inlineconstexpr

Memberwise add another point.

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

◆ operator-() [1/2]

FPoint SDL::FPoint::operator- ( ) const
inlineconstexpr

Get point's memberwise negation.

Returns
New Point representing memberwise negation

◆ operator-() [2/2]

FPoint SDL::FPoint::operator- ( const FPoint & 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-=()

FPoint & SDL::FPoint::operator-= ( const FPoint & other)
inlineconstexpr

Memberwise subtract another point.

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

◆ operator/() [1/2]

FPoint SDL::FPoint::operator/ ( const FPoint & 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]

FPoint SDL::FPoint::operator/ ( float value) const
inlineconstexpr

Get point's memberwise division by an float.

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

◆ operator/=() [1/2]

FPoint & SDL::FPoint::operator/= ( const FPoint & other)
inlineconstexpr

Memberwise divide by another point.

Parameters
[in]otherDivisor
Returns
Reference to self

◆ operator/=() [2/2]

FPoint & SDL::FPoint::operator/= ( float value)
inlineconstexpr

Memberwise divide by an float.

Parameters
[in]valueDivisor
Returns
Reference to self

◆ SetX()

FPoint & SDL::FPoint::SetX ( float newX)
inlineconstexprnoexcept

Set the x coordinate.

Parameters
newXthe new x coordinate.
Returns
Reference to self.

◆ SetY()

FPoint & SDL::FPoint::SetY ( float newY)
inlineconstexprnoexcept

Set the y coordinate.

Parameters
newYthe new y coordinate.
Returns
Reference to self.

◆ Wrap()

FPoint & SDL::FPoint::Wrap ( const FRect & rect)
constexpr

Wrap point coordinates within a specified rect.

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

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