forked from GodotECS/godex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
33 lines (26 loc) · 840 Bytes
/
main.cpp
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
#include "main/main.h"
#include "core/object/message_queue.h"
#include "databags/frame_time.h"
#include "ecs.h"
#include "main/main_timer_sync.h"
#include "world/world.h"
bool Main::custom_iteration(float p_process_delta, float p_physics_delta, MainFrameTime *p_frame_time, float p_time_scale) {
MessageQueue::get_singleton()->flush();
World *w = ECS::get_singleton()->get_active_world();
if (likely(w)) {
FrameTime *info = w->get_databag<FrameTime>();
if (likely(info)) {
info->set_main_frame_time(*p_frame_time);
info->set_delta(p_process_delta * p_time_scale);
info->set_physics_delta(p_physics_delta * p_time_scale);
}
}
ECS::get_singleton()->dispatch_active_world();
if (likely(w)) {
FrameTime *info = w->get_databag<FrameTime>();
if (likely(info)) {
return info->get_exit();
}
}
return false;
}