-
Notifications
You must be signed in to change notification settings - Fork 54
/
main.cpp
39 lines (29 loc) · 802 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
34
35
36
37
38
39
#include <UECS/UECS.hpp>
#include <iostream>
using namespace Ubpa;
using namespace Ubpa::UECS;
using namespace std;
struct P {};
struct V {};
struct A {};
struct VP_System {
static void OnUpdate(Schedule& schedule) {
schedule.RegisterEntityJob([](const V*, P*) {cout << "VP" << endl; }, "VP");
}
};
struct AVP_System {
static void OnUpdate(Schedule& schedule) {
schedule.RegisterEntityJob([](const A*, V*, P*) {cout << "AVP" << endl; }, "AVP");
schedule.AddNone("VP", TypeID_of<A>);
}
};
int main() {
World w;
w.entityMngr.cmptTraits.Register<A, V, P>();
w.systemMngr.RegisterAndActivate<VP_System, AVP_System>();
w.entityMngr.Create(Ubpa::TypeIDs_of< V, P>);
w.entityMngr.Create(Ubpa::TypeIDs_of<A, V, P>);
w.Update();
cout << w.DumpUpdateJobGraph() << endl;
return 0;
}