Jazz2::Editor::MeasureTool class

Measures distances in the level and shows how far the player jumps.

A drag measures from where it starts to where it ends, in pixels and in tiles, and shows the arcs of the jumps chosen in the options of the tool — walking, dashing, the double jump of Spaz and the copter of Jazz — from its start, where the feet of the player are, towards its end. They jump as the game does with the gameplay it's set to: the original game in its ticks (see Actors::Player::LegacyJumpSpeed and the other Legacy constants, the movement applied in a tick held to 8 px), or the Reforged jump that rises on an internal force, in frames at 60 FPS. It tells the easiest of them that gets over to the end. The jumps stop at the solid tiles of the sprite layer and end where they land, unless that's turned off. Started on a spring, it shows how the spring throws the player instead, how high or how far, roughly. With Ctrl both ends snap to the middle of a tile. The measurement stays until the next one, the right button clears it.

Base classes

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

Public types

struct JumpArc
One of the jumps the tool shows.

Public static functions

static void GetJumpPath(const JumpArc& arc, Vector2f start, float direction, SmallVectorImpl<Vector2f>& path, Tiles::TileMap* collisions = nullptr)
Returns the path of a jump, a point each tick, until it lands or falls far below its start.
static auto Reaches(const JumpArc& arc, Vector2f start, Vector2f target, Tiles::TileMap* collisions = nullptr) -> bool
Returns true if a jump gets over to a point, landing on it or above it.

Constructors, destructors, conversion operators

MeasureTool(IToolHost& host) explicit

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.
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.

Function documentation

static void Jazz2::Editor::MeasureTool::GetJumpPath(const JumpArc& arc, Vector2f start, float direction, SmallVectorImpl<Vector2f>& path, Tiles::TileMap* collisions = nullptr)

Returns the path of a jump, a point each tick, until it lands or falls far below its start.

start is where the feet of the player are, direction 1 to the right, -1 to the left. With collisions the path stops at walls and ceilings of the sprite layer and ends where it lands.