rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.73k stars 208 forks source link

Call drawGrid() and drawCells() prior to the first invocation of tick(). #122

Closed jwir3 closed 5 years ago

jwir3 commented 5 years ago

Summary

This PR adds a drawGrid() and drawCells() call just before the first call to requestAnimationFrame() in order to ensure that the initial state of the universe is drawn prior to executing a Universe.tick() call.

Explain the motivation for making this change. What existing problem does the pull request solve? 🤔

If this is not done, the initial state of the universe is never drawn, which can be confusing for those looking to implement the exercises where a specific starting set of cells is desired.

jwir3 commented 5 years ago

Yep, will do.

jwir3 commented 5 years ago

Added a PR here: https://github.com/rustwasm/wasm_game_of_life/pull/37

jwir3 commented 5 years ago

Also, I've updated the later code in interactivity.md to account for the source change mentioned above.