Jazz2::Editor::MaskOverlay class

Shows the collision masks of a layer over the level.

Solid parts are darkened and outlined, the outline goes around whole shapes, across the edges of tiles. The masks are put together into textures of square chunks of tiles, kept until the tiles of a chunk change, and drawn with fewer pixels when the view is far. The outline is traced from the pixels of a chunk once, as lines between the middles of the edges of its pixels, so a slope is a straight line instead of steps, and it's drawn antialiased at the same thickness however close the view is, but not when a tile is only a few pixels large.

A layer that repeats has the same chunks wherever its pattern repeats. The chunks drawn the longest time ago are dropped once they take more memory than allowed, never those drawn in the frame, whose images are still to be drawn.

Public static variables

static std::int32_t ChunkTiles constexpr
Tiles on a side of a chunk.

Constructors, destructors, conversion operators

MaskOverlay()
~MaskOverlay()

Public functions

void Invalidate()
Drops all chunks.
void Release()
Drops all chunks and the memory used to make them, while the masks aren't shown.
void InvalidateTiles(std::int32_t layer, const Recti& area)
Drops the chunks with tiles of an area of a layer, and those next to it.
void InvalidateTileIds(const LevelDocument& document, ArrayView<const std::uint16_t> sortedTileIds)
Drops the chunks that show any of the tiles, after their masks changed, the tile IDs have to be sorted.
void Draw(Painter& painter, Tiles::TileMap& tileMap, const LevelDocument& document, std::int32_t layer, const LayerView& view, const Rectf& viewRect, bool alone)
Draws the masks of a layer.

Function documentation

void Jazz2::Editor::MaskOverlay::Draw(Painter& painter, Tiles::TileMap& tileMap, const LevelDocument& document, std::int32_t layer, const LayerView& view, const Rectf& viewRect, bool alone)

Draws the masks of a layer.

Parameters
painter Painter
tileMap Shown level
document The level
layer Index of the layer
view How the layer is shown
viewRect Part of the screen the level is seen in
alone Whether the masks are shown instead of the level, not over it