Skip to content

Commit

Permalink
Fix game of life (yewstack#1339)
Browse files Browse the repository at this point in the history
* follow changes in rand crate

`wasm-bindgen` feature is not forwarded any more. See:
rust-random/rand@0aa4617

* update index.html to new template

See:
https://yew.rs/docs/getting-started/build-a-sample-app

* correct dimensions of playground

tested with Firefox 77.0.1

* Update examples/game_of_life/src/lib.rs

Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>

Co-authored-by: Jens Getreu <getreu@saar1.lan>
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 22, 2020
1 parent e0aec40 commit 9965744
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
8 changes: 5 additions & 3 deletions examples/game_of_life/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
[package]
name = "game_of_life"
version = "0.1.3"
version = "0.1.4"
authors = ["Diego Cardoso <dige0card0s0@hotmail.com>",
"Ilya Bogdanov <fumlead@gmail.com",
"Junjie Huang <huangjj.27@qq.com>"]
edition = "2018"

[dependencies]
rand = "0.7.3"
log = "0.4"
log = "0.4.8"
wasm-logger = "0.2.0"
yew = { path = "../../yew" }
rand = { version = "0.7.3", features = ["getrandom"] }
getrandom = { version = "0.1.14", features = ["wasm-bindgen"] }

4 changes: 2 additions & 2 deletions examples/game_of_life/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ impl Component for Model {
Cellule {
life_state: LifeState::Dead
};
2000
53 * 40
],
cellules_width: 50,
cellules_width: 53,
cellules_height: 40,
job: Box::new(handle),
}
Expand Down
11 changes: 6 additions & 5 deletions examples/game_of_life/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
<head>
<meta charset="utf-8">
<title>Yew • Game of Life</title>
<link rel="stylesheet" href="styles.css">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="./styles.css">
<script type="module">
import init from "./wasm.js"
init()
</script>
</head>
<body>
<script src="game_of_life.js"></script>
</body>
<body></body>
</html>

0 comments on commit 9965744

Please sign in to comment.