Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTweenInit.cpp
More file actions
Latest commit
38 lines (31 loc) · 1.04 KB
/
Copy pathTweenInit.cpp
File metadata and controls
38 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include"TweenInit.h"
#include"TweenManager.h"
#include"DekiEngine.h"
#include"DekiLogSystem.h"
#include<cstdint>
namespace
{
constexprsize_tkNotRegistered = SIZE_MAX;
size_t s_UpdateId = kNotRegistered;
} // namespace
voidDekiTween_InitSystem()
{
if (s_UpdateId != kNotRegistered)
return;
// EnsureUpdatedThisFrame() rather than Update(): it is frame-guarded, so a
// TweenComponent that also ticks the manager this frame does not advance
// every tween twice.
s_UpdateId = Deki::Engine::GetInstance().RegisterUpdate(
[](uint32_t/*deltaTimeMs*/)
{ Deki::TweenManager::Instance().EnsureUpdatedThisFrame(); });
DEKI_LOG_INTERNAL("DekiTween: tween manager hooked into the engine update");
}
voidDekiTween_ShutdownSystem()
{
if (s_UpdateId == kNotRegistered)
return;
// Must happen before the DLL unloads: the callback's code lives here.
Deki::Engine::GetInstance().UnregisterUpdate(s_UpdateId);
s_UpdateId = kNotRegistered;
Deki::TweenManager::Instance().KillAll();
}