comparison examples/example-battle/main.c @ 300:3638b39ef2bf

examples: fix with new game_push function
author David Demelier <markand@malikania.fr>
date Sun, 11 Apr 2021 17:43:57 +0200
parents 196264679079
children d01e83210ca2
comparison
equal deleted inserted replaced
299:648f5f949afb 300:3638b39ef2bf
180 bt->background = &registry_images[REGISTRY_IMAGE_BATTLE_BACKGROUND]; 180 bt->background = &registry_images[REGISTRY_IMAGE_BATTLE_BACKGROUND];
181 181
182 battle_start(bt); 182 battle_start(bt);
183 183
184 fight_state.data = bt; 184 fight_state.data = bt;
185 game_switch(&fight_state, 0); 185 game_push(&fight_state);
186 } 186 }
187 187
188 188
189 static void 189 static void
190 empty_handle(struct state *st, const union event *ev) 190 empty_handle(struct state *st, const union event *ev)
237 fight_update(struct state *st, unsigned int ticks) 237 fight_update(struct state *st, unsigned int ticks)
238 { 238 {
239 struct battle *bt = st->data; 239 struct battle *bt = st->data;
240 240
241 if (battle_update(bt, ticks)) 241 if (battle_update(bt, ticks))
242 game_switch(&empty_state, 0); 242 game_push(&empty_state);
243 } 243 }
244 244
245 static void 245 static void
246 fight_draw(struct state *st) 246 fight_draw(struct state *st)
247 { 247 {
266 }; 266 };
267 267
268 static void 268 static void
269 run(void) 269 run(void)
270 { 270 {
271 game_switch(&empty_state, 1); 271 game_push(&empty_state);
272 game_loop(); 272 game_loop();
273 } 273 }
274 274
275 static void 275 static void
276 quit(void) 276 quit(void)