diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-23 21:11:50 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2022-04-23 21:11:50 -0700 |
commit | e2fe11469394c9827a0cdea9966188c833d93197 (patch) | |
tree | 9efcd1651e92bc7db4d63f0e0953343ed35b91ca /web/dartboat_wasm.c | |
parent | 2cd3bddfa34929411737ebae1f2e99fcb0cb25e2 (diff) | |
download | dartboat-e2fe11469394c9827a0cdea9966188c833d93197.tar.gz dartboat-e2fe11469394c9827a0cdea9966188c833d93197.tar.xz |
web: implement prompt-aware keypad
Diffstat (limited to 'web/dartboat_wasm.c')
-rw-r--r-- | web/dartboat_wasm.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/web/dartboat_wasm.c b/web/dartboat_wasm.c index ccde71a..006ec1e 100644 --- a/web/dartboat_wasm.c +++ b/web/dartboat_wasm.c @@ -79,12 +79,17 @@ EMSCRIPTEN_KEEPALIVE int is_match_over() { } void match_over() { - EM_ASM({setPromptHandler($0)}, "init"); - EM_ASM({promptMsgL($0)}, "Enter match mode:"); - EM_ASM({promptMsgR($0)}, "1 to play against bot\n2 to play against player"); + EM_ASM({setPromptHandler($0)}, "match_over"); + EM_ASM({promptMsgR($0)}, "Press OK to end match."); EM_ASM(setPlayerActive()); } +EMSCRIPTEN_KEEPALIVE void match_init() { + EM_ASM({setPromptHandler($0)}, "init"); + EM_ASM({promptMsgR($0)}, ""); + EM_ASM({promptMsgL($0)}, "Select match mode:"); +} + EMSCRIPTEN_KEEPALIVE void draw_match() { struct leg *l1 = state->l1; struct leg *l2 = state->l2; @@ -333,7 +338,6 @@ EMSCRIPTEN_KEEPALIVE void resp_numdarts(int n_darts) { ((double)l->start / (((l->n_visits - 1) * 3) + n_darts)) * 3); EM_ASM({promptMsgL($0)}, "You win! :)"); match_over(); - EM_ASM({setPromptHandler($0)}, "init"); } void init_boat() { @@ -403,5 +407,5 @@ EMSCRIPTEN_KEEPALIVE void set_delay(int delay) { int main() { EM_ASM(read_opts()); init_boat(); - match_over(); + match_init(); } |