Jazz2::Editor::TileSelection class

Selected tiles of a layer.

Public functions

auto IsEmpty() const -> bool
Returns true if nothing is selected.
auto GetLayer() const -> std::int32_t
Returns the layer of the selection, or -1.
auto GetBounds() const -> const Recti&
Returns the bounds of the selected tiles.
auto Contains(std::int32_t x, std::int32_t y) const -> bool
Returns true if a tile is selected.
void Clear()
Clears the selection.
void Select(std::int32_t layer, Vector2i layerSize, const Recti& area, bool add)
Selects tiles of a layer, given its size, replacing or adding to what was selected.
void Select(std::int32_t layer, Vector2i layerSize, const BitArray& mask, bool add)
Selects tiles given by a function, replacing or adding to what was selected.
void Deselect(const Recti& area)
Takes the tiles of an area of the layer of the selection out of it.
void Invert(std::int32_t layer, Vector2i layerSize)
Selects the tiles of a layer that aren't selected, and only them.
void Grow(bool shrink)
Adds the tiles around the selected ones, or with shrink takes away the selected tiles at its edge.
auto GetMask() const -> const BitArray&
Returns the selected tiles as one bit for each tile of the layer, row by row.
auto GetLayerSize() const -> Vector2i
Returns the size of the layer of the selection.
auto GetRevision() const -> std::uint32_t
Returns a number that changes whenever the selection does.

Function documentation

std::uint32_t Jazz2::Editor::TileSelection::GetRevision() const

Returns a number that changes whenever the selection does.

The numbers come from one counter for all selections, so two selections with the same number are the same, what's drawn of a selection can be kept until its number changes.