Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

timer.h

Go to the documentation of this file.
00001 
00003 
00004 #ifndef header_timer
00005 #define header_timer
00006 
00007 #include "keep_alive.h"
00008 #include "../../signals.h"
00009 
00010 class CL_Timer : public CL_KeepAlive
00011 //: Timer signal emitter.
00012 // Use this class to emit a signal as a timer event.
00013 {
00014 public:
00015         CL_Timer(unsigned long interval = 1000);
00016         // Constructs and registers the timer as a keep_alive listener.
00018         
00019         virtual void keep_alive();
00020         // Called when CL_System::keep_alive() is called.
00021 
00022         CL_Signal_v0 sig_timer;
00023         // Signal emitted everytime the interval has elapsed.
00024         
00025         void set_interval(unsigned long interval);
00026         // Sets a new interval for the timer.
00028 
00029         unsigned long get_interval();
00030         // Returns the current time interval.
00032 
00033         void enable();
00034         // Call this function to enable the timer.
00035         
00036         void disable();
00037         // Call this function to disable the timer.
00038         
00039 private:
00040         unsigned long interval;
00041         unsigned long last_time;
00042         bool enabled;
00043 };
00044 
00045 #endif

Generated at Wed Apr 4 19:54:04 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001