Jazz2::Editor::EventGizmos class

Finds the handles of events and changes their parameters by them.

Public static functions

static void Collect(const Formats::EventRecord& event, Vector2i cell, std::int32_t levelWidth, SmallVectorImpl<EventGizmo>& gizmos)
Adds the handles of an event at a tile of the event grid.
static auto Apply(Formats::EventRecord& event, Vector2i cell, std::int32_t levelWidth, const EventGizmo& gizmo, Vector2f world, bool snap = false) -> bool
Changes the parameter of a handle of an event so the handle is at a position in the level.
static auto GetDragDirection(const Formats::EventRecord& event, const EventGizmo& gizmo) -> Vector2f
Returns which way a handle of an event is dragged, as arrows by the pointer show it.

Constructors, destructors, conversion operators

EventGizmos() deleted

Function documentation

static void Jazz2::Editor::EventGizmos::Collect(const Formats::EventRecord& event, Vector2i cell, std::int32_t levelWidth, SmallVectorImpl<EventGizmo>& gizmos)

Adds the handles of an event at a tile of the event grid.

levelWidth is the width of the level in pixels, where a camera limit of no width ends.

static bool Jazz2::Editor::EventGizmos::Apply(Formats::EventRecord& event, Vector2i cell, std::int32_t levelWidth, const EventGizmo& gizmo, Vector2f world, bool snap = false)

Changes the parameter of a handle of an event so the handle is at a position in the level.

With snap, a direction (see EventGizmoKind::Direction) goes only horizontally, vertically or diagonally, as long as it's dragged. Returns false if the event doesn't change.

static Vector2f Jazz2::Editor::EventGizmos::GetDragDirection(const Formats::EventRecord& event, const EventGizmo& gizmo)

Returns which way a handle of an event is dragged, as arrows by the pointer show it.

A unit vector along the line the handle moves on, X to the right and Y down, or a zero vector for a handle dragged any way, as an offset or the arrow of a tube.