StrokeTool class
#include <Jazz2/Editor/Tools/TileTools.h>
Base of the tools that paint tiles.
What is painted is shown right away, but it's a single change of the level only once the pointer is released. Only selected tiles are painted while something is selected on the layer. A stamp with events (see TileStamp::
Base classes
- class EditorTool
- Tool used in the view of the level editor.
Derived classes
- class BrushTool
- Paints the stamp, or erases.
- class FillTool
- Fills an area of the same tiles with the stamp.
- class RectangleTool
- Fills a rectangle with the stamp.
- class ShapeTool
- Draws a line, the outline of a rectangle, or an ellipse with the stamp.
- class SmartBrushTool
- Paints ground, the tiles are chosen by the tiles around them.
Constructors, destructors, conversion operators
- StrokeTool(IToolHost& host) explicit
Public functions
- void OnDeactivate() override
- Called when another tool is chosen, anything in progress is cancelled.
- void Cancel() override
- Cancels what the tool is doing.
- auto IsBusy() const -> bool override
- Returns
trueif the tool is in the middle of something.
Protected functions
- auto BeginStroke(String name, bool preview = true) -> bool
- Starts a stroke on the current layer, returns
falseif the layer can't be changed. - auto PaintCell(Vector2i cell, const TileRef& tile) -> bool
- Paints a tile of the layer, given a cell of the view, returns
falseif it's outside of the layer or the selection. -
void PaintEvent(Vector2i layerTile,
const Formats::
EventRecord& event) - Places an event on the sprite layer with the stroke, given a tile of the layer, see TileStamp::
Events. -
void PaintOffGrid(const TileStamp& stamp,
std::
size_t index, Vector2i layerTile) - Places the events off the grid on a tile of a stamp with the stroke, the tile painted at a tile of the sprite layer, see TileStamp::
OffGridEvents. - void PaintStampCell(const TileStamp& stamp, Vector2i cell, Vector2i patternOrigin)
- Paints the tile a stamp repeated from an origin has at a cell of the view, with the options of the tools.
- void PaintStamp(const TileStamp& stamp, Vector2i cell, Vector2i anchor, Vector2i patternOrigin)
- Paints a stamp at a cell of the view, repeated from an origin, the cells it covered the last time in the stroke are left as they are.
- void EndStroke()
- Completes the stroke as a change of the level.
Protected variables
-
std::
unique_ptr<SetTilesCommand> _stroke -
std::
unique_ptr<SetEventsCommand> _eventStroke -
SmallVector<Formats::
OffGridEventRecord, 0> _pendingOffGrid -
std::
int32_t _strokeLayer - LayerView _strokeView
- bool _strokePreview
- bool _strokeOptions
- bool _strokeOnlyEmpty
- bool _strokeEmptyToo
- const TileStamp* _lastStamp
- Recti _lastStampArea
- Vector2i _lastStampOrigin
Function documentation
bool Jazz2:: Editor:: StrokeTool:: BeginStroke(String name,
bool preview = true) protected
Starts a stroke on the current layer, returns false if the layer can't be changed.
A stroke without preview is completed right away, its tiles are only shown as a change of the level.