Jazz2::UI::Menu::MenuTransition class

Drives an animated transition between two menu sections.

Owns the lifecycle of the section animating out and computes the per-layer draw transform (offset, scale, tint) applied to the outgoing and incoming sections while the transition plays. The effect is realized purely through Canvas::LayerOffset / Canvas::LayerScale / Canvas::LayerColor, so no render targets or extra draw calls are needed. A forward (push) transition keeps the outgoing section owned by the container and only hides it on completion; a backward (pop) transition takes ownership of the popped section so it can finish animating before being destroyed. Both menu containers own one of these and share all of the logic here.

Public static functions

static void ResetTransform(Canvas* canvas)
Resets a canvas draw transform back to identity.
static auto CombineClip(const nCine::Recti& a, const nCine::Recti& b, nCine::Vector2i viewSize) -> nCine::Recti
Combines two section clip rectangles into one that covers both while a transition plays.

Constructors, destructors, conversion operators

MenuTransition()

Public functions

auto IsActive() const -> bool
Returns true if a transition is currently playing.
auto GetOutgoing() const -> MenuSection*
Returns the section animating out, or nullptr if no transition is active.
void BeginForward(MenuSection* outgoing, const TransitionInfo& info)
Starts a forward (push) transition; the outgoing section stays owned by the container.
void BeginBackward(std::unique_ptr<MenuSection> outgoing, const TransitionInfo& info)
Starts a backward (pop) transition; takes ownership of the outgoing section until it finishes.
void Skip()
Finishes any active transition immediately.
auto Update(float timeMult) -> bool
Advances the transition; returns true if it finished during this call.
void ApplyTransform(Canvas* canvas, bool incoming, nCine::Vector2i viewSize) const
Applies the transition's draw transform for the given role (incoming/outgoing) onto a canvas.

Function documentation

static nCine::Recti Jazz2::UI::Menu::MenuTransition::CombineClip(const nCine::Recti& a, const nCine::Recti& b, nCine::Vector2i viewSize)

Combines two section clip rectangles into one that covers both while a transition plays.

Empty rectangles (a section with no clipped layer) are ignored; if both are empty the full view is used. This keeps the clipped layer properly clipped during a transition instead of showing unclipped content.