From 7f2c82eb85379745733a01cce42c960f267999d3 Mon Sep 17 00:00:00 2001 From: Tdxdxoz Date: Sun, 18 Feb 2024 18:56:23 +0800 Subject: [PATCH] show --- main.css | 10 ++++++++++ src/game.rs | 9 ++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/main.css b/main.css index 380f2ed..91d532f 100644 --- a/main.css +++ b/main.css @@ -28,6 +28,16 @@ body { height: 100vh; } +.loading-hint { + position: fixed; + top: 50%; + left: 0; + width: 100vw; + font-size: 48px; + font-weight: bold; + text-align: center; +} + canvas { width: 100%; touch-action: none; diff --git a/src/game.rs b/src/game.rs index 9ccc179..55b8f1b 100644 --- a/src/game.rs +++ b/src/game.rs @@ -29,6 +29,8 @@ const NEXT_BALL_TIME_DIST: f64 = 3.0 * BALL_SIZE; const NEW_BALL_ID: i32 = -1; +const FULL_RESOURCE: u8 = 3; + const EPS: f64 = 1e-10; macro_rules! clone_all { @@ -638,7 +640,7 @@ pub fn game(props: &Props) -> Html { use_effect_with( (canvas_ref, *mw, *mh, *is_game_over, *resource_state), move |(canvas_ref, mw, mh, is_game_over, resource_state)| { - if *resource_state != 3 { + if *resource_state != FULL_RESOURCE { return; } @@ -726,6 +728,11 @@ pub fn game(props: &Props) -> Html { onpointermove={draw_aimline} onpointerup={onclick} /> + if *resource_state != FULL_RESOURCE { +
+ { "Loading..." } +
+ }