- Main Page
- Classes
- Files

- File List

# C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.40/Woopsi/libwoopsi/include/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
    00013         class WoopsiTimer : public Gadget {
    00014         public:
    00015
    00022                 WoopsiTimer(u32 timeout, bool repeat);
    00023
    00028                 inline const u32 getTimeout() const { return _timeout; };
    00029
    00035                 inline const u32 getFrameCount() const { return _frameCount; };
    00036
    00040                 inline void reset() { _frameCount = 0; };
    00041
    00045                 inline void start() { _isRunning = true; };
    00046
    00050                 inline void stop() {
    00051                         _isRunning = false;
    00052                         _frameCount = 0;
    00053                 };
    00054
    00058                 inline void pause() { _isRunning = false; }
    00059
    00064                 inline void setTimeout(u32 timeout) { _timeout = timeout; };
    00065
    00070                 virtual bool run();
    00071
    00072         protected:
    00073                 u32 _frameCount;
    00074                 u32 _timeout;
    00075                 bool _isRunning;
    00076                 bool _isRepeater;
    00081                 virtual inline ~WoopsiTimer() {
    00082                         if (woopsiApplication != NULL) {
    00083
    00084                                 // Prevent gadget from receiving VBLs
    00085                                 woopsiApplication->unregisterFromVBL(this);
    00086                         }
    00087                 };
    00088
    00092                 inline WoopsiTimer(const WoopsiTimer& woopsiTimer) : Gadget(woopsiTimer) { };
    00093         };
    00094 }
    00095
    00096 #endif