Skip to content

Commit

Permalink
Allow restarting game under wasm
Browse files Browse the repository at this point in the history
We were ignoring the results and therefore restarting the game didn't
work because we never replaced the old state with the new one.
  • Loading branch information
tomassedovic committed Dec 21, 2017
1 parent 0195b27 commit 6707b53
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,14 @@ pub fn update(state_ptr: *mut State, dt_ms: u32) {
&mut drawcalls,
);

match result {
game::RunningState::Running => {}
game::RunningState::NewGame(new_state) => {
*state = new_state;
}
game::RunningState::Stopped => {},
}

engine::sort_drawcalls(&mut drawcalls, 0..);

// Each "drawcall" will be 6 u8 values: x, y, char, r, g, b
Expand Down

0 comments on commit 6707b53

Please sign in to comment.