MenuTransition class
#include <Jazz2/UI/Menu/MenuTransition.h>
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::
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
Public functions
- auto IsActive() const -> bool
- Returns
trueif a transition is currently playing. - auto GetOutgoing() const -> MenuSection*
- Returns the section animating out, or
nullptrif 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
trueif 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.