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 FPoint (float v) 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 FPointoperator+= (const FPoint &other)
 Memberwise add another point.
constexpr FPointoperator-= (const FPoint &other)
 Memberwise subtract another point.
constexpr FPointoperator/= (const FPoint &other)
 Memberwise divide by another point.
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
GetRectEnclosingPointsFloat
PointInRectFloat

Constructor & Destructor Documentation

◆ FPoint() [1/3]

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

Wraps FPoint.

Parameters
pthe value to be wrapped

◆ FPoint() [2/3]

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

Constructs from its fields.

Parameters
xthe value for x.
ythe value for y.

◆ FPoint() [3/3]

SDL::FPoint::FPoint ( float v)
inlineconstexprnoexcept

Constructs from its fields.

Parameters
vthe value for x and 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*=()

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

Memberwise multiply by another point.

Parameters
[in]otherMultiplier
Returns
Reference to self

◆ 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-()

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

Get point's memberwise negation.

Returns
New Point representing memberwise negation

◆ 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/=()

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

Memberwise divide by another point.

Parameters
[in]otherDivisor
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: