![]() |
galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
|
Rectangle 2D bin packing class. More...
#include <RectPack.hpp>
Collaboration diagram for galaxy::RectPack:Public Member Functions | |
| RectPack () noexcept | |
| Constructor. | |
| ~RectPack () noexcept | |
| Destructor. | |
| void | init (const int width, const int height) noexcept |
| Set starting width and height of rectangle. | |
| std::optional< iRect > | pack (const int width, const int height) |
| Pack a rectangle into the master rectangle. | |
| void | clear () noexcept |
| Clear all data. | |
| int | get_width () const noexcept |
| Get total width. | |
| int | get_height () const noexcept |
| Get total height. | |
| const std::vector< iRect > & | get_free_space () const noexcept |
| Get free rectangles. | |
Private Attributes | |
| int | m_width |
| The starting width of the rectangle. | |
| int | m_height |
| The starting width of the rectangle. | |
| std::vector< iRect > | m_free_rects |
| Free space in master rectangle. | |
Rectangle 2D bin packing class.
Definition at line 21 of file RectPack.hpp.
|
noexcept |
Constructor.
Definition at line 12 of file RectPack.cpp.
|
noexcept |
Destructor.
Definition at line 18 of file RectPack.cpp.
|
noexcept |
Set starting width and height of rectangle.
Generally should be a power of 2.
| width | Width of the master rectangle. |
| height | Height of the master rectangle. |
Definition at line 23 of file RectPack.cpp.
Here is the caller graph for this function:
|
nodiscard |
Pack a rectangle into the master rectangle.
| width | Width of the rectangle to pack. |
| height | Height of the rectangle to pack. |
Definition at line 31 of file RectPack.cpp.
Here is the caller graph for this function:
|
noexcept |
Clear all data.
Definition at line 90 of file RectPack.cpp.
Here is the caller graph for this function:
|
nodiscardnoexcept |
Get total width.
Definition at line 96 of file RectPack.cpp.
Here is the caller graph for this function:
|
nodiscardnoexcept |
Get total height.
Definition at line 101 of file RectPack.cpp.
Here is the caller graph for this function:
|
nodiscardnoexcept |
Get free rectangles.
Definition at line 106 of file RectPack.cpp.
Here is the caller graph for this function:
|
private |
The starting width of the rectangle.
Definition at line 89 of file RectPack.hpp.
|
private |
The starting width of the rectangle.
Definition at line 94 of file RectPack.hpp.
|
private |
Free space in master rectangle.
Definition at line 99 of file RectPack.hpp.