Allow testing the individual Rust tutorial steps by hand

Might be useful for regression testing
This commit is contained in:
Simon Hausmann 2021-06-17 10:37:37 +02:00
parent b67ad35319
commit a31e7e4220
4 changed files with 38 additions and 2 deletions

View file

@ -37,6 +37,7 @@ members = [
'tests/driver/cpp', 'tests/driver/cpp',
'tests/driver/nodejs', 'tests/driver/nodejs',
'tests/driver/interpreter', 'tests/driver/interpreter',
'docs/tutorial/src',
] ]
default-members = [ default-members = [

View file

@ -0,0 +1,35 @@
[package]
name = "src"
version = "0.1.0"
authors = ["SixtyFPS <info@sixtyfps.io>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "memory_tutorial_initial"
path = "main_initial.rs"
[[bin]]
name = "memory_tutorial_tile"
path = "main_memory_tile.rs"
[[bin]]
name = "memory_tutorial_polishing_the_tile"
path = "main_polishing_the_tile.rs"
[[bin]]
name = "memory_tutorial_multiple_tiles"
path = "main_multiple_tiles.rs"
[[bin]]
name = "memory_tutorial_tiles_from_rust"
path = "main_tiles_from_rust.rs"
[[bin]]
name = "memory_tutorial_game_logic_in_rust"
path = "main_game_logic_in_rust.rs"
[dependencies]
sixtyfps = { path = "../../../api/sixtyfps-rs" }
rand = "0.8"

View file

@ -15,13 +15,13 @@ index with a little bit of spacing between the tiles.
First, we copy the tile data structure definition and paste it at top inside the `sixtyfps!` macro: First, we copy the tile data structure definition and paste it at top inside the `sixtyfps!` macro:
```60 ```60
{{#include main_from_one_to_multiple_tiles.rs:tile_data}} {{#include main_multiple_tiles.rs:tile_data}}
``` ```
Next, we replace the *`MainWindow` := { ... }* section at the bottom of the `sixtyfps!` macro with the following snippet: Next, we replace the *`MainWindow` := { ... }* section at the bottom of the `sixtyfps!` macro with the following snippet:
```60 ```60
{{#include main_from_one_to_multiple_tiles.rs:main_window}} {{#include main_multiple_tiles.rs:main_window}}
``` ```
The `for tile[i] in memory_tiles :` syntax declares a variable `tile` which contains the data of one element from the `memory_tiles` array, The `for tile[i] in memory_tiles :` syntax declares a variable `tile` which contains the data of one element from the `memory_tiles` array,