diff --git a/MiniEngine.h b/MiniEngine.h index 6412c3b..eca3106 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -467,11 +467,21 @@ namespace MiniEngine { public: Timer(); - /// Uint32 func(Uint32,void*) ... + + /// void func(Uint32,...) + template + Timer(Uint32 interval,VoidCallable&& vcallable,Args&&... args) : Timer() + { + auto realCall=[&](Uint32 ims)->Uint32{vcallable(ims,args...);return interval;}; + auto pfunc=new std::function(realCall); + _real_timer_call(_global_timer_executor,interval,pfunc); + } + + /// Uint32 func(Uint32,...) template Timer(Callable&& callable,Uint32 interval,Args&&... args) : Timer() { - auto realCall=[&](Uint32 interval)->Uint32{return callable(interval,args...);}; + auto realCall=[&](Uint32 ims)->Uint32{return callable(ims,args...);}; auto pfunc=new std::function(realCall); _real_timer_call(_global_timer_executor,interval,pfunc); }