From b293efe3dc1fd562da86ed232283a35f158f70e6 Mon Sep 17 00:00:00 2001 From: Thilo Behnke Date: Sun, 3 Jul 2022 23:53:58 +0200 Subject: [PATCH] show score in gui --- client/svelte-client/src/App.svelte | 5 +++- .../src/components/Canvas.svelte | 2 +- .../svelte-client/src/components/Fps.svelte | 2 +- .../svelte-client/src/components/Score.svelte | 28 +++++++++++++++++++ .../src/components/TickWrapper.svelte | 1 - 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 client/svelte-client/src/components/Score.svelte diff --git a/client/svelte-client/src/App.svelte b/client/svelte-client/src/App.svelte index b1ee4e7..230eddc 100644 --- a/client/svelte-client/src/App.svelte +++ b/client/svelte-client/src/App.svelte @@ -12,6 +12,7 @@ import {SessionType} from "./store/model/session"; import EvenTicker from "./components/EvenTicker.svelte"; import Line from "./components/Line.svelte"; + import Score from "./components/Score.svelte"; let sessionStore: Readable; let debug = false; @@ -64,9 +65,11 @@
- tick(...event.detail)} let:dimensions={dimensions}> + + {JSON.stringify(tick.score)} +
diff --git a/client/svelte-client/src/components/Canvas.svelte b/client/svelte-client/src/components/Canvas.svelte index b4c8f08..8c6e492 100644 --- a/client/svelte-client/src/components/Canvas.svelte +++ b/client/svelte-client/src/components/Canvas.svelte @@ -95,6 +95,6 @@ style="width: {$width}px; height: {$height}px;" > - + diff --git a/client/svelte-client/src/components/Fps.svelte b/client/svelte-client/src/components/Fps.svelte index 8891907..43d3c93 100644 --- a/client/svelte-client/src/components/Fps.svelte +++ b/client/svelte-client/src/components/Fps.svelte @@ -20,7 +20,7 @@ + + import type {GameScore} from "../store/engine"; + import Text from "./Text.svelte"; + + export let dimensions: { width: number, height: number }; + export let score: GameScore; + + +{#if score} + + + +{/if} diff --git a/client/svelte-client/src/components/TickWrapper.svelte b/client/svelte-client/src/components/TickWrapper.svelte index 08fcc49..fa02bc1 100644 --- a/client/svelte-client/src/components/TickWrapper.svelte +++ b/client/svelte-client/src/components/TickWrapper.svelte @@ -37,6 +37,5 @@ } } -{JSON.stringify($gameField.score)}