Jazz2::Editor::EventTool class

Places, selects, moves and erases events.

Events are always on the sprite layer, whichever layer is being edited. A click on an empty tile places the events of the stamp and dragging goes on placing them; a click on an event selects it and dragging moves the selected events. Ctrl adds to or removes from the selection and a drag over empty tiles with it selects the events in a rectangle, Shift places the stamp over events, Alt picks an event as the stamp and the right button erases events. A single selected event shows handles of its parameters that can be dragged in the view, see EventGizmos. Events off the grid are dragged to another position, with Shift to the center of a tile, erased with the right button and picked with Alt the same way.

With EventPlaceMode::Select nothing is placed, events are selected as the select tool selects tiles: a drag from an empty spot selects those in a rectangle, with Shift adds them to the selection and with Ctrl takes them out of it. A click selects an event, with Shift adds it and with Ctrl adds it or takes it away, a click on an empty spot ends the selection.

Base classes

class EditorTool
Tool used in the view of the level editor.

Constructors, destructors, conversion operators

EventTool(IToolHost& host) explicit
~EventTool() override

Public functions

auto GetType() const -> EditorToolType override
Returns the type.
void OnDeactivate() override
Called when another tool is chosen, anything in progress is cancelled.
void OnPointerDown(const ToolPointer& pointer) override
Called when the pointer is pressed over the view.
void OnPointerMove(const ToolPointer& pointer) override
Called when the pointer moves over the view, pressed or not.
void OnPointerUp(const ToolPointer& pointer) override
Called when the pointer is released.
auto OnKeyPressed(const KeyboardEvent& event) -> bool override
While events off the grid are dragged, X or Y held snaps that axis, see GetOffGridTarget().
void OnKeyReleased(const KeyboardEvent& event) override
Called when a key is released, whatever got it when it was pressed.
void Cancel() override
Cancels what the tool is doing.
auto IsBusy() const -> bool override
Returns true if the tool is in the middle of something.
void DrawOverlay(Painter& painter, const ToolPointer& hover, bool hoverValid) override
Draws what the tool shows over the view.
auto GetHint() const -> StringView override
Returns a hint of how the tool is used.
void BuildOptions(ToolOptionsBuilder& builder) override
Makes the options of the tool shown in the toolbar while it's chosen, none by default.
auto PlaceOnCells(ArrayView<const Vector2i> cells, bool overwrite) -> std::int32_t
Places the single event of the stamp on tiles of the event grid as one step, returns how many it was placed on.
auto IsMovingEvents() const -> bool
Whether the selected events are being dragged to another place, where they were is faded meanwhile.

Function documentation

std::int32_t Jazz2::Editor::EventTool::PlaceOnCells(ArrayView<const Vector2i> cells, bool overwrite)

Places the single event of the stamp on tiles of the event grid as one step, returns how many it was placed on.

Tiles with an event keep it unless overwrite.