-
Notifications
You must be signed in to change notification settings - Fork 54
/
main.cpp
50 lines (41 loc) · 1.22 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <UECS/UECS.hpp>
#include <iostream>
using namespace Ubpa::UECS;
struct A {};
struct B {};
struct C {};
struct PrintASystem {
static void OnUpdate(Schedule& schedule) {
schedule.RegisterEntityJob([](A*) {
std::cout << "A" << std::endl;
}, "Parallel Print A");
auto spilt = schedule.RegisterJob([]() {
std::cout << "vvvvvvvvvv" << std::endl;
}, "Spilt");
schedule.RegisterEntityJob([](const A*) {
std::cout << "A" << std::endl;
}, "Serial Print A", false);
schedule.Order("Parallel Print A", "Spilt");
schedule.Order("Spilt", "Serial Print A");
}
};
int main() {
World w;
w.entityMngr.cmptTraits.Register<A, B, C>();
w.systemMngr.RegisterAndActivate<PrintASystem>();
w.entityMngr.Create(Ubpa::TypeIDs_of<A>);
w.entityMngr.Create(Ubpa::TypeIDs_of<A, B>);
w.entityMngr.Create(Ubpa::TypeIDs_of<A, C>);
w.entityMngr.Create(Ubpa::TypeIDs_of<A, B, C>);
for (std::size_t i = 0; i < 5; i++) {
w.Update();
std::cout << "^^^^^^^^^^" << std::endl;
}
for (std::size_t i = 0; i < 100; i++)
w.entityMngr.Create();
w.RunEntityJob([](Entity e) {
std::cout << e.index << std::endl;
}, false);
std::cout << w.DumpUpdateJobGraph() << std::endl;
std::cout << w.GenUpdateFrameGraph().Dump() << std::endl;
}