feat: add snek game pixel stream example
This commit is contained in:
59
test/pixelstream/snek/public/index.html
Normal file
59
test/pixelstream/snek/public/index.html
Normal file
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Snek 16x16</title>
|
||||
<style>
|
||||
:root {
|
||||
color-scheme: dark;
|
||||
}
|
||||
body {
|
||||
font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
|
||||
background: #0b0b0b;
|
||||
color: #e8e8e8;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin: 0;
|
||||
padding: 24px 12px;
|
||||
}
|
||||
h2 { margin: 0 0 4px 0; font-weight: 600; }
|
||||
#board {
|
||||
width: 640px; /* make it big */
|
||||
height: 640px; /* make it big */
|
||||
image-rendering: pixelated;
|
||||
border: 1px solid #333;
|
||||
background: #000;
|
||||
box-shadow: 0 8px 24px rgba(0,0,0,0.5);
|
||||
}
|
||||
.hud {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.status {
|
||||
display: inline-flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
.dot { width: 10px; height: 10px; border-radius: 50%; background: #a33; }
|
||||
.dot.ok { background: #3a3; }
|
||||
.pill { padding: 2px 8px; border: 1px solid #333; border-radius: 999px; font-size: 12px; }
|
||||
.hint { color: #aaa; font-size: 12px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h2>16×16 Snek</h2>
|
||||
<div class="hud">
|
||||
<div>Score: <span id="score">0</span></div>
|
||||
<div class="status"><span class="dot" id="ws-dot"></span><span class="pill" id="ws-label">WS: connecting…</span></div>
|
||||
</div>
|
||||
<canvas id="board" width="16" height="16"></canvas>
|
||||
<div class="hint">Arrow keys to move. Space to restart.</div>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user