summary refs log tree commit diff stats
path: root/src/game.h
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2022-03-13 13:21:17 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2022-03-13 13:21:17 -0400
commit016d1cdf036039792f50e1ed0431386c7b9e93d7 (patch)
treee5f773f34b05c4fd8c73247eae9d20514fa450df /src/game.h
parentb2dfe21775a55e815b2572d844c749c5108671fe (diff)
downloadether-016d1cdf036039792f50e1ed0431386c7b9e93d7.tar.gz
ether-016d1cdf036039792f50e1ed0431386c7b9e93d7.tar.bz2
ether-016d1cdf036039792f50e1ed0431386c7b9e93d7.zip
refactored game code into the game class (for titles / multiple games)
Diffstat (limited to 'src/game.h')
-rw-r--r--src/game.h56
1 files changed, 46 insertions, 10 deletions
diff --git a/src/game.h b/src/game.h index 9feb774..89b9eb2 100644 --- a/src/game.h +++ b/src/game.h
@@ -87,18 +87,15 @@ struct MapData {
87class Game { 87class Game {
88public: 88public:
89 89
90 Game(std::mt19937& rng) : 90 Game(std::mt19937& rng, Muxer& muxer);
91 rng(rng), 91
92 map( 92 void update(size_t dt);
93 -INIT_ZOOM * ZOOM_X_FACTOR / 2,
94 -INIT_ZOOM * ZOOM_Y_FACTOR / 2,
95 INIT_ZOOM * ZOOM_X_FACTOR,
96 INIT_ZOOM * ZOOM_Y_FACTOR)
97 {
98 }
99 93
100 std::mt19937& rng; 94 std::mt19937& rng;
101 Muxer muxer; 95 Muxer& muxer;
96
97 bool quit = false;
98 LoseState losing = LoseState::None;
102 99
103 Map<MapData> map; 100 Map<MapData> map;
104 std::list<Kickup> kickups; 101 std::list<Kickup> kickups;
@@ -129,6 +126,7 @@ public:
129 int lastZoomWidth; 126 int lastZoomWidth;
130 int lastZoomHeight; 127 int lastZoomHeight;
131 128
129 Input keystate;
132 bool firstInput = false; 130 bool firstInput = false;
133 Input lastInput; 131 Input lastInput;
134 bool alreadyBumped = false; 132 bool alreadyBumped = false;
@@ -137,6 +135,44 @@ public:
137 bool moving = false; 135 bool moving = false;
138 bool queueDash = false; 136 bool queueDash = false;
139 137
138 Timer dustTimer = {40};
139 Timer inputTimer = {50};
140 Timer losePopLampTimer = {800};
141 Timer losePopPlayerTimer = {3000};
142 Timer zoomTimer = {62};
143
144private:
145
146 void tick(
147 int x1,
148 int y1,
149 int x2,
150 int y2,
151 bool invert = false,
152 bool onlyDark = false);
153
154 void tick(bool onlyDark = false);
155
156 bool movePlayer(int x, int y);
157
158 void recalculateLighting();
159
160 void recalculateRender();
161
162 bool processKeys(const Input& keystate);
163
164 void kickUpDust(int x, int y, size_t chain);
165
166 void popLamp(int x, int y, size_t chain);
167
168 void processKickup();
169
170 void growMap(size_t zoom);
171
172 void setZoom(size_t zoom);
173
174 void performDash();
175
140}; 176};
141 177
142#endif /* end of include guard: GAME_H_7D2B65AE */ 178#endif /* end of include guard: GAME_H_7D2B65AE */