Float vector of 4 positions with an X, Y, W and H elements defining a rectangle and conversion with SDL_FRect for ease of use with SDL. It allows basic operations with other rectangles, vectors or scalars.
More...
#include <Types.hpp>
|
|
| Rectf (float _x=0, float _y=0, float _w=0, float _h=0) |
|
| Rectf (const Rectf &r) |
|
| Rectf (Rectf &&r) |
|
| Rectf (Vector2f pos, Vector2f size) |
|
| Rectf (const SDL_FRect &r) |
|
| operator SDL_FRect () const |
|
Rectf & | operator= (const Rectf &other) |
|
Rectf & | operator= (const SDL_FRect &other) |
| Rectf & | operator+= (const Vector2f &rhs) |
| | Moves the position of the rect adding a vector.
|
| Rectf & | operator-= (const Vector2f &rhs) |
| | Moves the position of the rect subtracting a vector.
|
|
bool | operator== (const Rectf &rhs) |
| Vector2f | GetPosition () const |
| | Gets the x and y elements of the rectangle.
|
| void | SetPosition (const Vector2f &pos) |
| | Sets the x and y elements of the rectangle.
|
| void | SetPosition (const float &newX, const float &newY) |
| | Sets the x and y elements of the rectangle.
|
| Vector2f | GetSize () const |
| | Gets the w and h elements of the rectangle.
|
| void | SetSize (const Vector2f &size) |
| | Sets the w and h elements of the rectangle.
|
| void | SetSize (const float &newW, const float &newH) |
| | Sets the w and h elements of the rectangle.
|
| void | Scale (const float &scale) |
| | Multiplies the size vector by an scalar value.
|
| bool | IsTextureValid () |
| | Utility method to check if a texture is valid. A texture is valid when its width and height are greater than 0.
|
|
|
float | x |
|
float | y |
|
float | w |
|
float | h |
|
| Rectf | operator+ (Rectf lhs, const Vector2f &rhs) |
| | Moves the position of the rect adding a vector.
|
| Rectf | operator- (Rectf lhs, const Vector2f &rhs) |
| | Moves the position of the rect subtracting a vector.
|
|
bool | operator== (const Rectf &lhs, const Rectf &rhs) |
Float vector of 4 positions with an X, Y, W and H elements defining a rectangle and conversion with SDL_FRect for ease of use with SDL. It allows basic operations with other rectangles, vectors or scalars.
◆ GetPosition()
| Vector2f Mochi::Rectf::GetPosition |
( |
| ) |
const |
|
inline |
Gets the x and y elements of the rectangle.
- Returns
- The vector of the position.
◆ GetSize()
| Vector2f Mochi::Rectf::GetSize |
( |
| ) |
const |
|
inline |
Gets the w and h elements of the rectangle.
- Returns
- The vector of the size.
◆ IsTextureValid()
| bool Mochi::Rectf::IsTextureValid |
( |
| ) |
|
|
inline |
Utility method to check if a texture is valid. A texture is valid when its width and height are greater than 0.
- Returns
- True if the texture is valid, false otherwise.
◆ operator+=()
| Rectf & Mochi::Rectf::operator+= |
( |
const Vector2f & | rhs | ) |
|
|
inline |
Moves the position of the rect adding a vector.
- Parameters
-
- Returns
- Modified rect
◆ operator-=()
| Rectf & Mochi::Rectf::operator-= |
( |
const Vector2f & | rhs | ) |
|
|
inline |
Moves the position of the rect subtracting a vector.
- Parameters
-
- Returns
- Modified rect
◆ Scale()
| void Mochi::Rectf::Scale |
( |
const float & | scale | ) |
|
|
inline |
Multiplies the size vector by an scalar value.
- Parameters
-
◆ SetPosition() [1/2]
| void Mochi::Rectf::SetPosition |
( |
const float & | newX, |
|
|
const float & | newY ) |
|
inline |
Sets the x and y elements of the rectangle.
- Parameters
-
| newX | New X value |
| newY | New Y value |
◆ SetPosition() [2/2]
| void Mochi::Rectf::SetPosition |
( |
const Vector2f & | pos | ) |
|
|
inline |
Sets the x and y elements of the rectangle.
- Parameters
-
◆ SetSize() [1/2]
| void Mochi::Rectf::SetSize |
( |
const float & | newW, |
|
|
const float & | newH ) |
|
inline |
Sets the w and h elements of the rectangle.
- Parameters
-
| newW | New w value. |
| newH | New h value. |
◆ SetSize() [2/2]
| void Mochi::Rectf::SetSize |
( |
const Vector2f & | size | ) |
|
|
inline |
Sets the w and h elements of the rectangle.
- Parameters
-
◆ operator+
| Rectf operator+ |
( |
Rectf | lhs, |
|
|
const Vector2f & | rhs ) |
|
friend |
Moves the position of the rect adding a vector.
- Parameters
-
- Returns
- Resulting rect
◆ operator-
| Rectf operator- |
( |
Rectf | lhs, |
|
|
const Vector2f & | rhs ) |
|
friend |
Moves the position of the rect subtracting a vector.
- Parameters
-
- Returns
- Resulting rect
The documentation for this struct was generated from the following file: