PlayTransition class
Reveals the level being played from the editor in a growing ring.
A thick ring appears in the middle of the screen and grows until it's larger than the screen. Outside of it the last image of what was shown is still there, inside of it what is shown now is seen already. The ring has the color of the level, see FindAccentColor(). It's drawn above the slot of the painter, so whatever the editor still shows outside of it in that slot is covered by it.
With an image of the inside, the transition is drawn in two parts: the outside under the interface, and the inside with the ring over it, so the interface is still seen outside of the ring.
Public static variables
- static float Duration constexpr
- Length of the transition in frames at 60 a second.
Constructors, destructors, conversion operators
- PlayTransition()
- ~PlayTransition()
- PlayTransition(const PlayTransition&) deleted
Public functions
- auto operator=(const PlayTransition&) -> PlayTransition& deleted
- void Start(Texture* outside, Texture* inside, const Colorf& color)
- Starts the transition.
- void Stop()
- Ends the transition at once.
- auto IsActive() const -> bool
- Returns
truewhile the transition is shown. - auto HasInside() const -> bool
- Returns
trueif the transition has an image of the inside, see DrawRing(). - void SetProgress(float progress, bool hold)
- Shows the transition at a point between 0 and 1,
holdstops it there, for testing. - void Update(float timeMult)
- Advances the transition.
- void Draw(Painter& painter, Vector2f screenSize)
- Draws the transition over a screen of a size, both parts at once.
- void DrawOutside(Painter& painter, Vector2f screenSize)
- Draws only the image of the outside, under what is drawn after it.
- void DrawRing(Painter& painter, Vector2f screenSize)
- Draws only the image of the inside, if there's one, and the ring.
- void GetHole(Vector2f screenSize, float uiScale, Vector2f& center, float& radius, float& outer) const
- Returns the circle in which the game is seen, on a screen of a size at a scale of the interface.
Function documentation
void Jazz2:: Editor:: PlayTransition:: Start(Texture* outside,
Texture* inside,
const Colorf& color)
Starts the transition.
outside is shown outside of the ring, it has to stay as it is until the transition ends. inside is shown inside of it, or nullptr if what is under the transition is seen there. The ring is drawn in color.
void Jazz2:: Editor:: PlayTransition:: GetHole(Vector2f screenSize,
float uiScale,
Vector2f& center,
float& radius,
float& outer) const
Returns the circle in which the game is seen, on a screen of a size at a scale of the interface.
The ring goes around it, outer is where the ring ends and the image of the editor starts.