TimerInfo重命名为TimerEntity,并加入e2d namespace

This commit is contained in:
Nomango 2018-05-22 23:55:53 +08:00
parent f91973255d
commit 384f332b6d
1 changed files with 55 additions and 52 deletions

View File

@ -1,10 +1,12 @@
#include "..\e2dtool.h" #include "..\e2dtool.h"
#include "..\e2dnode.h" #include "..\e2dnode.h"
class TimerInfo namespace e2d
{ {
public: class TimerEntity
TimerInfo( {
public:
TimerEntity(
const e2d::Function& func, const e2d::Function& func,
const e2d::String& name, const e2d::String& name,
double delay, double delay,
@ -51,7 +53,7 @@ public:
return false; return false;
} }
public: public:
bool running; bool running;
bool stopped; bool stopped;
int runTimes; int runTimes;
@ -60,14 +62,15 @@ public:
double lastTime; double lastTime;
e2d::String name; e2d::String name;
e2d::Function callback; e2d::Function callback;
}; };
}
static std::vector<TimerInfo*> s_vTimers; static std::vector<e2d::TimerEntity*> s_vTimers;
void e2d::Timer::start(const Function& func, double delay, int updateTimes, bool paused, const String& name) void e2d::Timer::start(const Function& func, double delay, int updateTimes, bool paused, const String& name)
{ {
auto timer = new (std::nothrow) TimerInfo(func, name, delay, updateTimes, paused); auto timer = new (std::nothrow) TimerEntity(func, name, delay, updateTimes, paused);
s_vTimers.push_back(timer); s_vTimers.push_back(timer);
} }
@ -78,7 +81,7 @@ void e2d::Timer::start(const Function& func, const String& name)
void e2d::Timer::startOnce(const Function& func, double timeOut) void e2d::Timer::startOnce(const Function& func, double timeOut)
{ {
auto timer = new (std::nothrow) TimerInfo(func, L"", timeOut, 1, false); auto timer = new (std::nothrow) TimerEntity(func, L"", timeOut, 1, false);
s_vTimers.push_back(timer); s_vTimers.push_back(timer);
} }