First steps of WASM support
This commit is contained in:
parent
e3ba7ac440
commit
6f36bb344a
4 changed files with 13 additions and 25 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
/target
|
||||
/Cargo.lock
|
||||
.idea/
|
||||
pkg/
|
|
@ -3,8 +3,11 @@ name = "word_grid"
|
|||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
csv = "1.2.2"
|
||||
rand = {version = "0.8.5", features = ["small_rng"]}
|
||||
getrandom = {version = "0.2", features = ["js"]}
|
||||
wasm-bindgen = "0.2.87"
|
|
@ -1,6 +1,14 @@
|
|||
use wasm_bindgen::prelude::wasm_bindgen;
|
||||
|
||||
pub mod constants;
|
||||
pub mod board;
|
||||
pub mod dictionary;
|
||||
pub mod player_interaction;
|
||||
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn return_option(some: bool) -> Option<String> {
|
||||
if some {
|
||||
Some("Heyo".to_string())
|
||||
} else {None}
|
||||
}
|
24
src/main.rs
24
src/main.rs
|
@ -1,24 +0,0 @@
|
|||
use word_grid::board::{Board, Coordinates, Letter};
|
||||
|
||||
fn main() {
|
||||
let mut board = Board::new();
|
||||
|
||||
let c1 = board.get_cell_mut(Coordinates(8, 6)).unwrap();
|
||||
c1.value = Some(Letter::new_fixed( 'J', 0));
|
||||
board.get_cell_mut(Coordinates(8, 7)).unwrap().value = Some(Letter::new_fixed('o', 0));
|
||||
board.get_cell_mut(Coordinates(8, 8)).unwrap().value = Some(Letter::new_fixed( 'e', 0));
|
||||
board.get_cell_mut(Coordinates(8, 9)).unwrap().value = Some(Letter::new_fixed( 'l', 0));
|
||||
|
||||
board.get_cell_mut(Coordinates(9, 8)).unwrap().value = Some(Letter::new_fixed( 'i', 0));
|
||||
board.get_cell_mut(Coordinates(9, 9)).unwrap().value = Some(Letter::new_fixed( 's', 0));
|
||||
|
||||
board.get_cell_mut(Coordinates(10, 8)).unwrap().value = Some(Letter::new_fixed( 'c', 0));
|
||||
board.get_cell_mut(Coordinates(10, 9)).unwrap().value = Some(Letter::new_fixed( 'o', 0));
|
||||
board.get_cell_mut(Coordinates(10, 10)).unwrap().value = Some(Letter::new_fixed( 'o', 0));
|
||||
board.get_cell_mut(Coordinates(10, 11)).unwrap().value = Some(Letter::new_fixed( 'l', 0));
|
||||
|
||||
println!("{}", board);
|
||||
|
||||
//println!("\x1b[38;5;196m Hello my name is Joel");
|
||||
//println!("\x1b[48;5;20m Hello my name is Joel");
|
||||
}
|
Loading…
Reference in a new issue