diff --git a/css/style.css b/css/style.css index 5eead56..a315b14 100644 --- a/css/style.css +++ b/css/style.css @@ -15,6 +15,10 @@ canvas { display: block; } +.canvas-stage { + position: relative; +} + .maze-layout { width: min(1100px, calc(100vw - 24px)); margin: 12px auto 20px; @@ -44,6 +48,36 @@ canvas { height: min(62vh, 680px); } +.canvas-hud { + position: absolute; + top: 14px; + left: 14px; + z-index: 2; + padding: 10px 12px; + border-radius: 12px; + background: rgba(6, 10, 15, 0.72); + border: 1px solid rgba(121, 174, 242, 0.3); + backdrop-filter: blur(8px); + box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28); + pointer-events: none; +} + +.canvas-hud-label { + font-size: 10px; + letter-spacing: 0.14em; + text-transform: uppercase; + color: #93a4b8; + margin-bottom: 4px; +} + +.canvas-hud-value { + font-size: 22px; + font-weight: 700; + line-height: 1; + color: #eef5ff; + text-shadow: 0 0 12px rgba(121, 174, 242, 0.35); +} + .control-panel { padding: 16px; overflow-y: auto; diff --git a/index.html b/index.html index 00f244f..17461b4 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,13 @@
Babylon Scene
- +
+ +
+
Elapsed time
+
0.0s
+
+
@@ -53,7 +59,7 @@
Seed: 0
Level: 1
-
Time: 0.0s
+
Time: 0.0
Key: no
Adjust settings, then start a run.
diff --git a/src/babylon_setup.js b/src/babylon_setup.js index 306c117..de0c859 100644 --- a/src/babylon_setup.js +++ b/src/babylon_setup.js @@ -6,6 +6,7 @@ import { gridCellToWorld, isWalkableCell } from "./game/grid.js"; // Initialize Babylon.js engine and scene const canvas = document.getElementById("renderCanvas"); const engine = new BABYLON.Engine(canvas, true); +const canvasTime = document.getElementById("canvas-time"); const scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color4(0.05, 0.07, 0.1, 1); @@ -99,6 +100,9 @@ engine.runRenderLoop(() => { sphereMaterial.diffuseColor = sharedState.runtime.hasKey ? new BABYLON.Color3(0.25, 0.8, 0.45) : new BABYLON.Color3(0.2, 0.55, 0.95); + if (canvasTime) { + canvasTime.textContent = `${sharedState.runtime.elapsedSeconds.toFixed(1)}s`; + } scene.render(); }); @@ -146,7 +150,8 @@ function buildLevelFromGrid(grid) { floor.position = new BABYLON.Vector3(0, 0, 0); floor.checkCollisions = true; const fm = new BABYLON.StandardMaterial('floorMat', scene); - fm.diffuseColor = new BABYLON.Color3(0.08, 0.08, 0.09); + fm.specularColor = new BABYLON.Color3(0.1, 0.1, 0.1); + fm.diffuseColor = new BABYLON.Color3(0.58, 0.58, 0.59); floor.material = fm; levelMeshes.push(floor);