first add files

This commit is contained in:
2019-11-29 11:58:31 +08:00
parent 9c86489a35
commit 15db8e01c7
16 changed files with 677 additions and 0 deletions

38
inc/hgl/util/time/Timer.h Normal file
View File

@@ -0,0 +1,38 @@
#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