From a83b43d1a2524a874214e7fc3f3576f28ffdf901 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Sat, 10 Aug 2019 11:20:40 -0700 Subject: [PATCH] life --- data/life/life.js | 5 +++++ life.html | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/data/life/life.js b/data/life/life.js index 859182f0..23c74546 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -71,6 +71,7 @@ function startGame() { } var context = playerList[i - 1].canvas.customVarContext context.textBaseline = "middle" + var tempFontSize = 100 context.font = "100pt belerenbsc" var currentLife = playerList[context.customVarCanvas.customVarID - 1].life context.fillStyle = "#222" @@ -81,6 +82,10 @@ function startGame() { } context.fillRect(tempCanvasWidth / -2, tempCanvasHeight / -2, tempCanvasWidth, tempCanvasHeight) context.fillStyle = "#eee" + while (context.measureText(currentLife).width >= tempCanvasWidth) { + tempFontSize -= 1 + context.font = tempFontSize + "pt belerenbsc" + } var horizontalShift = -1 * parseInt(context.measureText(currentLife).width) / 2 context.fillText(currentLife, horizontalShift, 0) } diff --git a/life.html b/life.html index de870d2b..e8e7a4e6 100644 --- a/life.html +++ b/life.html @@ -46,9 +46,9 @@
- Number of Players:
+ Number of Players

- Starting Life Total:
+ Starting Life Total

@@ -120,6 +120,7 @@ border: 1px solid white; width: auto; height: auto; + touch-action: manipulation; } .widePlayerBox { grid-column: 1 / span 2;