A grid-indexed collection of sf::IntRect regions.
More...
#include <ImageRects.h>
Public Member Functions | |
| ImageRects (int cols) | |
Construct an empty ImageRects with a known column count. | |
| const sf::IntRect & | getIntRect (int row, int col) |
| Return the rect for a given row and column. | |
| void | push (const sf::IntRect &int_rect) |
| Append a rect to the collection. | |
A grid-indexed collection of sf::IntRect regions.
ImageRects stores the sub-rectangle regions produced by TextureSlicer::getImageRects when a texture is divided into a uniform grid of rows and columns. Each rect describes the pixel bounds of one cell within the source texture, ready to be passed to sf::Sprite::setTextureRect for sprite-sheet animation or tile-based rendering.
Rects are stored in row-major order and accessed by (row, col) index.
Definition at line 36 of file ImageRects.h.
| ml::ImageRects::ImageRects | ( | int | cols | ) |
Construct an empty ImageRects with a known column count.
| cols | Number of columns in the source grid. Used to convert (row, col) indices to a flat vector position. |
| const sf::IntRect & ml::ImageRects::getIntRect | ( | int | row, |
| int | col ) |
Return the rect for a given row and column.
| row | Zero-based row index. |
| col | Zero-based column index. |
sf::IntRect for that cell. | void ml::ImageRects::push | ( | const sf::IntRect & | int_rect | ) |
Append a rect to the collection.
Called by TextureSlicer to populate the collection in row-major order. Direct use is uncommon outside of framework internals.
| int_rect | The rect to append. |