mirror of
https://github.com/Floriansylvain/WhateverWebGPU.git
synced 2026-08-19 11:43:26 +02:00
feat: enhance UI layout with controls panel and FPS overlay
This commit is contained in:
+25
-16
@@ -3,28 +3,37 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/webgpu.svg" />
|
<link rel="icon" type="image/svg+xml" href="/webgpu.svg" />
|
||||||
|
<link
|
||||||
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap"
|
||||||
|
rel="stylesheet"
|
||||||
|
/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Whatever WebGPU</title>
|
<title>Whatever WebGPU</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<canvas id="canvas" width="1024" height="1024"></canvas>
|
<div id="app">
|
||||||
<p id="fps">FPS:</p>
|
<div id="canvas-container">
|
||||||
<div>
|
<canvas id="canvas" width="1024" height="1024"></canvas>
|
||||||
<label for="compute-interval-slider"
|
<div id="overlay">
|
||||||
>Compute Interval (ms):
|
<span id="fps">FPS: --</span>
|
||||||
<span id="compute-interval-value">100</span></label
|
</div>
|
||||||
>
|
</div>
|
||||||
<div>
|
<div id="controls-panel">
|
||||||
<input
|
<h2>Controls</h2>
|
||||||
id="compute-interval-slider"
|
<label>
|
||||||
type="range"
|
Simulation interval
|
||||||
min="1"
|
<input
|
||||||
max="200"
|
type="range"
|
||||||
value="100"
|
id="compute-interval-slider"
|
||||||
/>
|
min="1"
|
||||||
|
max="1000"
|
||||||
|
value="100"
|
||||||
|
/>
|
||||||
|
<div><span id="compute-interval-value">100</span> ms</div>
|
||||||
|
</label>
|
||||||
|
<button id="reset-button">Reset Grid</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button id="reset-button">Reset Grid</button>
|
|
||||||
<script type="module" src="/src/main.ts"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+74
-8
@@ -1,24 +1,90 @@
|
|||||||
|
:root {
|
||||||
|
--bg: #0e0e10;
|
||||||
|
--fg: #ffffffcc;
|
||||||
|
--panel-bg: #1e1e22;
|
||||||
|
--accent: #3a82f7;
|
||||||
|
--font: "Inter", sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
background-color: var(--bg);
|
||||||
|
color: var(--fg);
|
||||||
|
font-family: var(--font);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-direction: column;
|
|
||||||
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
background-color: #222;
|
#app {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
color: #fff;
|
#canvas-container {
|
||||||
font-family: "Courier New", Courier, monospace;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
canvas {
|
canvas {
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 0 20px #000a;
|
||||||
image-rendering: pixelated;
|
image-rendering: pixelated;
|
||||||
}
|
}
|
||||||
|
|
||||||
#compute-interval-slider {
|
#overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 8px;
|
||||||
|
left: 12px;
|
||||||
|
background-color: #0008;
|
||||||
|
color: white;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 8px;
|
||||||
|
pointer-events: none;
|
||||||
|
font-family: monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
#controls-panel {
|
||||||
|
background-color: var(--panel-bg);
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: 12px;
|
||||||
|
width: 200px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 1rem;
|
||||||
|
box-shadow: 0 0 20px #0004;
|
||||||
|
}
|
||||||
|
|
||||||
|
#controls-panel h2 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 18px;
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.25rem;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="range"] {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
background-color: var(--accent);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 0.5rem;
|
||||||
|
border-radius: 8px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
transition: background 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
button:hover {
|
||||||
|
background-color: #2c6de5;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user