Skip to content

Commit

Permalink
show
Browse files Browse the repository at this point in the history
  • Loading branch information
OmmyZhang committed Feb 18, 2024
1 parent 0634f2c commit 7f2c82e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
10 changes: 10 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
9 changes: 8 additions & 1 deletion src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -726,6 +728,11 @@ pub fn game(props: &Props) -> Html {
onpointermove={draw_aimline}
onpointerup={onclick}
/>
if *resource_state != FULL_RESOURCE {
<div class="loading-hint">
{ "Loading..." }
</div>
}
<Settings
v={*v.borrow()}
{v_onchange}
Expand Down

0 comments on commit 7f2c82e

Please sign in to comment.