Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- File List

# woopsitimer.h

    00001 #ifndef _WOOPSI_TIMER_H_
    00002 #define _WOOPSI_TIMER_H_
    00003
    00004 #include <nds.h>
    00005 #include "gadget.h"
    00006 #include "woopsi.h"
    00007
    00008 namespace WoopsiUI {
    00009
    00023         class WoopsiTimer : public Gadget {
    00024         public:
    00025
    00032                 WoopsiTimer(u32 timeout, bool repeat);
    00033
    00038                 inline const u32 getTimeout() const { return _timeout; };
    00039
    00045                 inline const u32 getFrameCount() const { return _frameCount; };
    00046
    00050                 inline void reset() { _frameCount = 0; };
    00051
    00055                 inline void start() { _isRunning = true; };
    00056
    00060                 inline void stop() {
    00061                         _isRunning = false;
    00062                         _frameCount = 0;
    00063                 };
    00064
    00068                 inline void pause() { _isRunning = false; }
    00069
    00074                 inline void setTimeout(u32 timeout) { _timeout = timeout; };
    00075
    00080                 virtual bool run();
    00081
    00082         protected:
    00083                 u32 _frameCount;
    00084                 u32 _timeout;
    00085                 bool _isRunning;
    00086                 bool _isRepeater;
    00091                 virtual inline ~WoopsiTimer() {
    00092                         if (woopsiApplication != NULL) {
    00093
    00094                                 // Prevent gadget from receiving VBLs
    00095                                 woopsiApplication->unregisterFromVBL(this);
    00096                         }
    00097                 };
    00098
    00102                 inline WoopsiTimer(const WoopsiTimer& woopsiTimer) : Gadget(woopsiTimer) { };
    00103         };
    00104 }
    00105
    00106 #endif