diff --git a/src/game.rs b/src/game.rs index a45dda5..827c5c5 100644 --- a/src/game.rs +++ b/src/game.rs @@ -229,4 +229,10 @@ impl Game { } + pub fn add_word(&mut self, word: String) { + let word = word.to_uppercase(); + + self.dictionary.insert(word, -1.0); + } + } \ No newline at end of file diff --git a/src/wasm.rs b/src/wasm.rs index 40c3b8e..cc42b0a 100644 --- a/src/wasm.rs +++ b/src/wasm.rs @@ -126,5 +126,9 @@ impl GameWasm { } + pub fn add_word(&mut self, word: String) { + self.0.add_word(word); + } + } \ No newline at end of file diff --git a/ui/src/Game.tsx b/ui/src/Game.tsx index fc17b7b..b3fce4c 100644 --- a/ui/src/Game.tsx +++ b/ui/src/Game.tsx @@ -124,6 +124,11 @@ export function Game(props: {wasm: GameWasm, settings: Settings}) { } + function addWordFn(word: string) { + props.wasm.add_word(word); + logDispatch(