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:
+20
-11
@@ -3,28 +3,37 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<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" />
|
||||
<title>Whatever WebGPU</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="canvas-container">
|
||||
<canvas id="canvas" width="1024" height="1024"></canvas>
|
||||
<p id="fps">FPS:</p>
|
||||
<div>
|
||||
<label for="compute-interval-slider"
|
||||
>Compute Interval (ms):
|
||||
<span id="compute-interval-value">100</span></label
|
||||
>
|
||||
<div>
|
||||
<div id="overlay">
|
||||
<span id="fps">FPS: --</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="controls-panel">
|
||||
<h2>Controls</h2>
|
||||
<label>
|
||||
Simulation interval
|
||||
<input
|
||||
id="compute-interval-slider"
|
||||
type="range"
|
||||
id="compute-interval-slider"
|
||||
min="1"
|
||||
max="200"
|
||||
max="1000"
|
||||
value="100"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div><span id="compute-interval-value">100</span> ms</div>
|
||||
</label>
|
||||
<button id="reset-button">Reset Grid</button>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+74
-8
@@ -1,24 +1,90 @@
|
||||
:root {
|
||||
--bg: #0e0e10;
|
||||
--fg: #ffffffcc;
|
||||
--panel-bg: #1e1e22;
|
||||
--accent: #3a82f7;
|
||||
--font: "Inter", sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
background-color: var(--bg);
|
||||
color: var(--fg);
|
||||
font-family: var(--font);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex-direction: column;
|
||||
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
background-color: #222;
|
||||
#app {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
color: #fff;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
#canvas-container {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
canvas {
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 0 20px #000a;
|
||||
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%;
|
||||
}
|
||||
|
||||
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