diff --git a/client/svelte-client/src/App.svelte b/client/svelte-client/src/App.svelte index 6ab5642..b1ee4e7 100644 --- a/client/svelte-client/src/App.svelte +++ b/client/svelte-client/src/App.svelte @@ -11,6 +11,7 @@ import type {Readable} from "svelte/store"; import {SessionType} from "./store/model/session"; import EvenTicker from "./components/EvenTicker.svelte"; + import Line from "./components/Line.svelte"; let sessionStore: Readable; let debug = false; @@ -57,14 +58,15 @@ > {:else} - +
- tick(...event.detail)}> + tick(...event.detail)} let:dimensions={dimensions}> +
diff --git a/client/svelte-client/src/components/Canvas.svelte b/client/svelte-client/src/components/Canvas.svelte index b82cc74..b4c8f08 100644 --- a/client/svelte-client/src/components/Canvas.svelte +++ b/client/svelte-client/src/components/Canvas.svelte @@ -95,7 +95,6 @@ style="width: {$width}px; height: {$height}px;" > - - + diff --git a/client/svelte-client/src/components/Line.svelte b/client/svelte-client/src/components/Line.svelte new file mode 100644 index 0000000..887f586 --- /dev/null +++ b/client/svelte-client/src/components/Line.svelte @@ -0,0 +1,21 @@ + + + diff --git a/client/svelte-client/src/components/SessionWrapper.svelte b/client/svelte-client/src/components/SessionWrapper.svelte index d44af1e..e7c3993 100644 --- a/client/svelte-client/src/components/SessionWrapper.svelte +++ b/client/svelte-client/src/components/SessionWrapper.svelte @@ -13,12 +13,12 @@ {#if !session}

no session

{:else if session.type === SessionType.LOCAL} - - + + {:else} - - + + {/if}
diff --git a/client/svelte-client/src/components/Text.svelte b/client/svelte-client/src/components/Text.svelte index fa79ef2..6ba1b2f 100644 --- a/client/svelte-client/src/components/Text.svelte +++ b/client/svelte-client/src/components/Text.svelte @@ -15,7 +15,7 @@ renderable(props => { const { engineCtx: ctx } = props; if (text) { - ctx.fillStyle = 'black'; + ctx.fillStyle = color; ctx.font = `${fontSize}px ${fontFamily}`; ctx.textAlign = align; ctx.textBaseline = baseline; diff --git a/client/svelte-client/src/store/render.ts b/client/svelte-client/src/store/render.ts index 2af9dc0..8b27d1e 100644 --- a/client/svelte-client/src/store/render.ts +++ b/client/svelte-client/src/store/render.ts @@ -1,6 +1,6 @@ import main from "../main"; -const mainColor = '#ff3e00'; +export const mainColor = '#ff3e00'; export const drawObjects = (ctx: CanvasRenderingContext2D, objects, [width, height], debug = false) => { objects.forEach(obj => { @@ -33,7 +33,7 @@ export const drawObjects = (ctx: CanvasRenderingContext2D, objects, [width, heig }) } -const drawLine = (ctx, from_x, from_y, to_x, to_y, color) => { +export const drawLine = (ctx, from_x, from_y, to_x, to_y, color) => { ctx.beginPath(); ctx.moveTo(from_x, from_y); ctx.strokeStyle = color; diff --git a/pong/src/game_field.rs b/pong/src/game_field.rs index fb42cd9..79a88a9 100644 --- a/pong/src/game_field.rs +++ b/pong/src/game_field.rs @@ -242,8 +242,8 @@ impl DefaultGameObject { y: y as f64, }, Vector::new(0., 1.), - (field.width as f64) / 25., - (field.height as f64) / 4., + (field.width as f64) / 60., + (field.height as f64) / 10., ))), Box::new(DefaultPhysicsComp::new(Vector::zero(), true)), )) @@ -261,7 +261,7 @@ impl DefaultGameObject { y: y as f64, }, Vector::zero(), - (field.width as f64) / 80., + (field.width as f64) / 120., ))), Box::new(DefaultPhysicsComp::new(Vector::zero(), false)), )) @@ -349,7 +349,7 @@ pub enum Bound { TOP, RIGHT, BOTTOM, - LEFT, + LEFT } pub struct Bounds(pub Bound, pub Box);