Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
|
#include <woopsitimer.h>
Public Member Functions | |
WoopsiTimer (u32 timeout, bool repeat) | |
const u32 | getTimeout () const |
const u32 | getFrameCount () const |
void | reset () |
void | start () |
void | stop () |
void | pause () |
void | setTimeout (u32 timeout) |
virtual bool | run () |
Protected Member Functions | |
virtual | ~WoopsiTimer () |
WoopsiTimer (const WoopsiTimer &woopsiTimer) | |
Protected Attributes | |
u32 | _frameCount |
u32 | _timeout |
bool | _isRunning |
bool | _isRepeater |
Timer gadget. It can drive time-based events, animations, etc. All actions that are time or vertical blank based should be driven by a WoopsiTimer. Attempting to tie into libnds' low-level vertical blank interrupt can potentially cause all sorts of havoc.
Using the timer is simple:
The maximum speed for timer-driven code is one iteration per vertical blank.
WoopsiUI::WoopsiTimer::WoopsiTimer | ( | u32 | timeout, |
bool | repeat | ||
) |
Constructor.
timeout | Time, in frames, before the timer fires an EVENT_ACTION event. |
repeat | If true, the timer will fire multiple events. If false, the timer will fire just once and stop. |
virtual WoopsiUI::WoopsiTimer::~WoopsiTimer | ( | ) | [inline, protected, virtual] |
Destructor.
WoopsiUI::WoopsiTimer::WoopsiTimer | ( | const WoopsiTimer & | woopsiTimer | ) | [inline, protected] |
Copy constructor is protected to prevent usage.
const u32 WoopsiUI::WoopsiTimer::getFrameCount | ( | ) | const [inline] |
Return the number of frames that this timer has been running for since the last event fired.
const u32 WoopsiUI::WoopsiTimer::getTimeout | ( | ) | const [inline] |
Return the timeout of this timer.
void WoopsiUI::WoopsiTimer::pause | ( | ) | [inline] |
Stops the timer but does not reset the frame count.
void WoopsiUI::WoopsiTimer::reset | ( | ) | [inline] |
Resets the frame count back to 0.
virtual bool WoopsiUI::WoopsiTimer::run | ( | ) | [virtual] |
Run any code that should execute every VBL.
void WoopsiUI::WoopsiTimer::setTimeout | ( | u32 | timeout | ) | [inline] |
Set the timeout of this timer.
timeout | The number of frames that this timer will run before firing an event. |
void WoopsiUI::WoopsiTimer::start | ( | ) | [inline] |
Starts the timer.
void WoopsiUI::WoopsiTimer::stop | ( | ) | [inline] |
Stops the timer and resets the frame count.
u32 WoopsiUI::WoopsiTimer::_frameCount [protected] |
Number of frames run so far
bool WoopsiUI::WoopsiTimer::_isRepeater [protected] |
Indicates whether or not the timer repeats
bool WoopsiUI::WoopsiTimer::_isRunning [protected] |
Indicates whether or not the timer is running
u32 WoopsiUI::WoopsiTimer::_timeout [protected] |
Number of frames to run before firing an event