CMUtil/inc/hgl/util/time/Timer.h

39 lines
1.1 KiB
C
Raw Normal View History

2019-11-29 11:58:31 +08:00
#ifndef HGL_TIMER_INCLUDE
#define HGL_TIMER_INCLUDE
#include<hgl/type/DataType.h>
#include<hgl/object/Object.h>
namespace hgl
{
/**
* OnTimer事件通知应用程序时间到了
* 0使Enable设为false更为高效
*/
class Timer:public Object ///计时器类
{
protected:
double inter;
double next;
double GetInterval(){return inter;}
void SetInterval(double);
public: //属性
Property<double> Interval; ///<间隔时间虚拟变量,单位秒
public: //事件
DefEvent(void,OnTimer,(Object *)); ///<时间到了事件
public:
Timer(double=0);
virtual ~Timer()=default;
virtual void Update();
};//class Timer:public Object
}//namespace hgl
#endif//HGL_TIMER_INCLUDE