NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
m_fader_base.hpp
1#pragma once
2#include <game/mLib/m_color.hpp>
3
4/// @brief Base fader implementation.
5/// @ingroup mlib
7public:
8
9 /// @brief The fader's status.
10 enum EStatus {
11 OPAQUE, ///< The screen is completely blacked out.
12 HIDDEN, ///< The screen is completely unblocked.
13 FADE_IN, ///< Transition from OPAQUE to HIDDEN.
14 FADE_OUT ///< Transition from HIDDEN to OPAQUE.
15 };
16
17 /// @brief Some flags related to the fader.
18 /// @todo Figure out what these do.
19 /// @unofficial
20 enum FLAG_e {
21 FADE_IN_COMPLETE = BIT_FLAG(0),
22 FADE_OUT_COMPLETE = BIT_FLAG(1)
23 };
24
25 /// @brief Constructs a new fader.
26 /// @param color The fader's color.
27 /// @param status The fader's initial status (::OPAQUE or ::HIDDEN).
28 mFaderBase_c(const mColor &color, EStatus status);
29
30 virtual ~mFaderBase_c(); ///< Destroys the fader.
31
32 virtual void setStatus(EStatus status) = 0; ///< Sets the fader's status.
33 virtual EStatus getStatus() const; ///< Gets the fader's status.
34
35 /// @brief Initiates a fade in from pure blacked-out.
36 /// @details The screen must be ::OPAQUE for the operation to be executed.
37 /// @return If the action was carried out.
38 virtual bool fadeIn();
39
40 /// @brief Initiates a fade out from no-obstruction.
41 /// @details The screen must be ::HIDDEN for the operation to be executed.
42 /// @return If the action was carried out.
43 virtual bool fadeOut();
44
45 /// @brief Calculates the fader at the current frame.
46 /// @return If the operation was successful.
47 virtual int calc();
48
49 virtual void draw() = 0; ///< Draws the fader.
50
51 void setFrame(u16 duration); ///< Sets the duration of the fade. Duration must not be zero.
52 void setColor(const mColor &color); ///< Sets the fader's color. Alpha is not modified.
53
54protected:
55 EStatus mStatus; ///< The fader's status.
56 u8 mFlag; ///< The fader's flags.
57 u16 mFrameCount; ///< The fader's duration.
58 u16 mCurrFrame; ///< The fader's current frame.
59 mColor mFaderColor; ///< The fader's color.
60};
virtual ~mFaderBase_c()
Destroys the fader.
virtual void draw()=0
Draws the fader.
u16 mCurrFrame
The fader's current frame.
EStatus mStatus
The fader's status.
virtual EStatus getStatus() const
Gets the fader's status.
virtual void setStatus(EStatus status)=0
Sets the fader's status.
u8 mFlag
The fader's flags.
virtual bool fadeIn()
Initiates a fade in from pure blacked-out.
FLAG_e
Some flags related to the fader.
void setFrame(u16 duration)
Sets the duration of the fade. Duration must not be zero.
u16 mFrameCount
The fader's duration.
mColor mFaderColor
The fader's color.
mFaderBase_c(const mColor &color, EStatus status)
Constructs a new fader.
EStatus
The fader's status.
@ FADE_IN
Transition from OPAQUE to HIDDEN.
@ FADE_OUT
Transition from HIDDEN to OPAQUE.
@ HIDDEN
The screen is completely unblocked.
@ OPAQUE
The screen is completely blacked out.
virtual int calc()
Calculates the fader at the current frame.
virtual bool fadeOut()
Initiates a fade out from no-obstruction.
void setColor(const mColor &color)
Sets the fader's color. Alpha is not modified.
A 32-bit RGBA color.
Definition m_color.hpp:6