Fix game of life (#1339)

* follow changes in rand crate

`wasm-bindgen` feature is not forwarded any more. See:
0aa461715b

* 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>
This commit is contained in:
Jens Getreu 2020-06-22 09:32:41 +02:00 committed by GitHub
parent e0aec40fe0
commit 996574437a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 10 deletions

View File

@ -1,13 +1,15 @@
[package] [package]
name = "game_of_life" name = "game_of_life"
version = "0.1.3" version = "0.1.4"
authors = ["Diego Cardoso <dige0card0s0@hotmail.com>", authors = ["Diego Cardoso <dige0card0s0@hotmail.com>",
"Ilya Bogdanov <fumlead@gmail.com", "Ilya Bogdanov <fumlead@gmail.com",
"Junjie Huang <huangjj.27@qq.com>"] "Junjie Huang <huangjj.27@qq.com>"]
edition = "2018" edition = "2018"
[dependencies] [dependencies]
rand = "0.7.3" log = "0.4.8"
log = "0.4"
wasm-logger = "0.2.0" wasm-logger = "0.2.0"
yew = { path = "../../yew" } yew = { path = "../../yew" }
rand = { version = "0.7.3", features = ["getrandom"] }
getrandom = { version = "0.1.14", features = ["wasm-bindgen"] }

View File

@ -165,9 +165,9 @@ impl Component for Model {
Cellule { Cellule {
life_state: LifeState::Dead life_state: LifeState::Dead
}; };
2000 53 * 40
], ],
cellules_width: 50, cellules_width: 53,
cellules_height: 40, cellules_height: 40,
job: Box::new(handle), job: Box::new(handle),
} }

View File

@ -3,10 +3,11 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Yew • Game of Life</title> <title>Yew • Game of Life</title>
<link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="./styles.css">
<link rel="shortcut icon" href="favicon.ico"> <script type="module">
import init from "./wasm.js"
init()
</script>
</head> </head>
<body> <body></body>
<script src="game_of_life.js"></script>
</body>
</html> </html>