MCPcopy Create free account
hub / github.com/defold/defold / AddTimer

Function AddTimer

engine/script/src/script_timer.cpp:311–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309 }
310
311 HTimer AddTimer(HTimerWorld timer_world,
312 float delay,
313 bool repeat,
314 TimerCallback timer_callback,
315 uintptr_t owner,
316 uintptr_t userdata)
317 {
318 assert(timer_world != 0x0);
319 assert(delay >= 0.f);
320 assert(timer_callback != 0x0);
321
322 Timer* timer = AllocateTimer(timer_world, owner);
323 if (timer == 0x0)
324 {
325 return INVALID_TIMER_HANDLE;
326 }
327
328 timer->m_Delay = delay;
329 timer->m_Remaining = delay;
330 timer->m_UserData = userdata;
331 timer->m_Callback = timer_callback;
332 timer->m_Repeat = repeat;
333 timer->m_PrevCycleExcess = 0.0f;
334 timer->m_IsAlive = 1;
335
336 return timer->m_Handle;
337 }
338
339 bool CancelTimer(HTimerWorld timer_world, HTimer handle)
340 {

Callers 3

TimerDelayFunction · 0.85
TEST_FFunction · 0.85
cbMethod · 0.85

Calls 2

AllocateTimerFunction · 0.85
assertFunction · 0.50

Tested by 2

TEST_FFunction · 0.68
cbMethod · 0.68