diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2019-02-23 15:37:53 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2019-02-23 15:37:53 -0500 |
commit | 4c73347244a51bdd3f25e751afe641664e56ca3f (patch) | |
tree | 471cd6445db94258c484d988a23b3013e2ba04fd /src/simulation.cpp | |
parent | 3504fd5080dbcfd0172299c5c6d13895e53ad163 (diff) | |
download | dispatcher-4c73347244a51bdd3f25e751afe641664e56ca3f.tar.gz dispatcher-4c73347244a51bdd3f25e751afe641664e56ca3f.tar.bz2 dispatcher-4c73347244a51bdd3f25e751afe641664e56ca3f.zip |
Entities to be rendered are sorted by render layer
Partially just for fun.
Diffstat (limited to 'src/simulation.cpp')
-rw-r--r-- | src/simulation.cpp | 77 |
1 files changed, 37 insertions, 40 deletions
diff --git a/src/simulation.cpp b/src/simulation.cpp index 27ac6ab..98687b6 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp | |||
@@ -8,7 +8,44 @@ Simulation::Simulation( | |||
8 | const Level& level) : | 8 | const Level& level) : |
9 | level_(level) | 9 | level_(level) |
10 | { | 10 | { |
11 | id_type trainId = emplaceEntity(); | ||
12 | Entity& train = getEntity(trainId); | ||
13 | train.size = TILE_SIZE; | ||
14 | train.speed = schedule_.getBPS() * 2.0; | ||
15 | train.colliderType = ColliderType::train; | ||
16 | train.scheduled = true; | ||
17 | train.colorVal = 90; | ||
18 | train.gridPos = vec2s { 6, 1 }; | ||
19 | train.moveDir = Direction::left; | ||
11 | 20 | ||
21 | id_type playerId = emplaceEntity(); | ||
22 | Entity& player = getEntity(playerId); | ||
23 | player.size = TILE_SIZE; | ||
24 | player.speed = 3.0; | ||
25 | player.controllable = true; | ||
26 | player.colliderType = ColliderType::player; | ||
27 | player.colorVal = 180; | ||
28 | player.gridPos = vec2s { 1, 5 }; | ||
29 | |||
30 | id_type crateId = emplaceEntity(); | ||
31 | Entity& crate = getEntity(crateId); | ||
32 | crate.size = TILE_SIZE; | ||
33 | crate.speed = schedule_.getBPS() * 2.0; | ||
34 | crate.colliderType = ColliderType::crate; | ||
35 | crate.canBePushedBy.insert(ColliderType::player); | ||
36 | crate.canBePushedBy.insert(ColliderType::crate); | ||
37 | crate.canBePushedBy.insert(ColliderType::train); | ||
38 | crate.gridPos = vec2s { 4, 5 }; | ||
39 | |||
40 | id_type crateId2 = emplaceEntity(); | ||
41 | Entity& crate2 = getEntity(crateId2); | ||
42 | crate2.size = TILE_SIZE; | ||
43 | crate2.speed = schedule_.getBPS() * 2.0; | ||
44 | crate2.colliderType = ColliderType::crate; | ||
45 | crate2.canBePushedBy.insert(ColliderType::player); | ||
46 | crate2.canBePushedBy.insert(ColliderType::crate); | ||
47 | crate2.canBePushedBy.insert(ColliderType::train); | ||
48 | crate2.gridPos = vec2s { 6, 7 }; | ||
12 | 49 | ||
13 | id_type trackId = emplaceEntity(); | 50 | id_type trackId = emplaceEntity(); |
14 | Entity& track = getEntity(trackId); | 51 | Entity& track = getEntity(trackId); |
@@ -49,46 +86,6 @@ Simulation::Simulation( | |||
49 | track4.trackDir2 = Direction::down; | 86 | track4.trackDir2 = Direction::down; |
50 | track4.colorVal = 130; | 87 | track4.colorVal = 130; |
51 | track4.gridPos = vec2s { 7, 1 }; | 88 | track4.gridPos = vec2s { 7, 1 }; |
52 | |||
53 | |||
54 | id_type trainId = emplaceEntity(); | ||
55 | Entity& train = getEntity(trainId); | ||
56 | train.size = TILE_SIZE; | ||
57 | train.speed = schedule_.getBPS() * 2.0; | ||
58 | train.colliderType = ColliderType::train; | ||
59 | train.scheduled = true; | ||
60 | train.colorVal = 90; | ||
61 | train.gridPos = vec2s { 6, 1 }; | ||
62 | train.moveDir = Direction::left; | ||
63 | |||
64 | id_type playerId = emplaceEntity(); | ||
65 | Entity& player = getEntity(playerId); | ||
66 | player.size = TILE_SIZE; | ||
67 | player.speed = 3.0; | ||
68 | player.controllable = true; | ||
69 | player.colliderType = ColliderType::player; | ||
70 | player.colorVal = 180; | ||
71 | player.gridPos = vec2s { 1, 5 }; | ||
72 | |||
73 | id_type crateId = emplaceEntity(); | ||
74 | Entity& crate = getEntity(crateId); | ||
75 | crate.size = TILE_SIZE; | ||
76 | crate.speed = schedule_.getBPS() * 2.0; | ||
77 | crate.colliderType = ColliderType::crate; | ||
78 | crate.canBePushedBy.insert(ColliderType::player); | ||
79 | crate.canBePushedBy.insert(ColliderType::crate); | ||
80 | crate.canBePushedBy.insert(ColliderType::train); | ||
81 | crate.gridPos = vec2s { 4, 5 }; | ||
82 | |||
83 | id_type crateId2 = emplaceEntity(); | ||
84 | Entity& crate2 = getEntity(crateId2); | ||
85 | crate2.size = TILE_SIZE; | ||
86 | crate2.speed = schedule_.getBPS() * 2.0; | ||
87 | crate2.colliderType = ColliderType::crate; | ||
88 | crate2.canBePushedBy.insert(ColliderType::player); | ||
89 | crate2.canBePushedBy.insert(ColliderType::crate); | ||
90 | crate2.canBePushedBy.insert(ColliderType::train); | ||
91 | crate2.gridPos = vec2s { 6, 7 }; | ||
92 | } | 89 | } |
93 | 90 | ||
94 | void Simulation::tick( | 91 | void Simulation::tick( |