| 1 | <!DOCTYPE html> |
| 2 | <html lang="nl"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>Raytracer level-editor</title> |
| 6 | <style> |
| 7 | body { margin: 0; font: 14px/1.4 system-ui, sans-serif; background: #1a1a1e; color: #eee; display: flex; height: 100vh; } |
| 8 | aside { width: 280px; padding: 12px; overflow: auto; border-right: 1px solid #333; background: #121216; } |
| 9 | main { flex: 1; overflow: auto; padding: 12px; } |
| 10 | h1 { font-size: 16px; margin: 0 0 12px; } |
| 11 | h2 { font-size: 13px; margin: 16px 0 6px; color: #aaa; text-transform: uppercase; letter-spacing: .04em; } |
| 12 | button, select, input { font: inherit; margin: 2px 0; } |
| 13 | button { background: #2a2a32; color: #eee; border: 1px solid #555; padding: 4px 8px; cursor: pointer; border-radius: 4px; } |
| 14 | button.active, button:hover { background: #3a5a8a; } |
| 15 | .row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; } |
| 16 | #grid { image-rendering: pixelated; background: #000; cursor: crosshair; } |
| 17 | .swatch { width: 36px; height: 36px; border: 2px solid #444; padding: 0; background-size: cover; } |
| 18 | .swatch.active { border-color: #8af; } |
| 19 | ul { list-style: none; padding: 0; margin: 0; } |
| 20 | li { padding: 4px 6px; border-radius: 3px; } |
| 21 | a { color: #9cf; } |
| 22 | </style> |
| 23 | </head> |
| 24 | <body> |
| 25 | <aside> |
| 26 | <h1>Level-editor</h1> |
| 27 | <div class="row"><a href="index.html">← Spel</a></div> |
| 28 | <h2>Levels</h2> |
| 29 | <select id="level-select" style="width:100%"></select> |
| 30 | <div class="row"> |
| 31 | <button type="button" id="btn-add-level">+</button> |
| 32 | <button type="button" id="btn-dup-level">Dupliceer</button> |
| 33 | <button type="button" id="btn-del-level">Verwijder</button> |
| 34 | </div> |
| 35 | <label>Naam <input id="level-name" style="width:100%"></label> |
| 36 | <div class="row"> |
| 37 | W <input id="level-w" type="number" min="3" max="128" style="width:4em"> |
| 38 | H <input id="level-h" type="number" min="3" max="128" style="width:4em"> |
| 39 | <button type="button" id="btn-resize">Resize</button> |
| 40 | </div> |
| 41 | <h2>Gereedschap</h2> |
| 42 | <div class="row"> |
| 43 | <button type="button" data-tool="wall" class="active">Muur</button> |
| 44 | <button type="button" data-tool="floor">Vloer</button> |
| 45 | <button type="button" data-tool="ceiling">Plafond</button> |
| 46 | <button type="button" data-tool="spawn">Spawn</button> |
| 47 | <button type="button" data-tool="npc">NPC</button> |
| 48 | </div> |
| 49 | <h2>Muurtypes</h2> |
| 50 | <div class="row"> |
| 51 | <button type="button" data-wall="0">Leeg</button> |
| 52 | <button type="button" data-wall="1" class="swatch" style="background-image:url(images/stone.png)" title="stone"></button> |
| 53 | <button type="button" data-wall="3" class="swatch" style="background-image:url(images/wood.png)" title="wood"></button> |
| 54 | <button type="button" data-wall="2">Finish</button> |
| 55 | </div> |
| 56 | <h2>Textuur (vloer/plafond)</h2> |
| 57 | <div class="row"> |
| 58 | <button type="button" data-tex="none">Geen</button> |
| 59 | <button type="button" data-tex="stone" class="swatch" style="background-image:url(images/stone.png)"></button> |
| 60 | <button type="button" data-tex="wood" class="swatch" style="background-image:url(images/wood.png)"></button> |
| 61 | </div> |
| 62 | <h2>Spawn / NPC</h2> |
| 63 | <label>Spawn yaw ° <input id="spawn-yaw" type="number" value="0" style="width:5em"></label> |
| 64 | <label>NPC yaw ° <input id="npc-yaw" type="number" value="180" style="width:5em"></label> |
| 65 | <label>Clip |
| 66 | <select id="npc-clip"><option>walk</option><option>attack</option></select> |
| 67 | </label> |
| 68 | <label><input type="checkbox" id="npc-anim" checked> Animeren</label> |
| 69 | <button type="button" id="btn-del-npc">Verwijder NPC</button> |
| 70 | <ul id="npc-list"></ul> |
| 71 | <h2>Bestand</h2> |
| 72 | <div class="row"> |
| 73 | <button type="button" id="btn-download">Download JSON</button> |
| 74 | <label class="button">Upload <input type="file" id="file-upload" accept="application/json,.json" style="display:none"></label> |
| 75 | </div> |
| 76 | <div class="row"> |
| 77 | <button type="button" id="btn-play">Speel dit level</button> |
| 78 | <button type="button" id="btn-reload-repo">Herlaad repo</button> |
| 79 | </div> |
| 80 | <p style="color:#888;font-size:12px">Opslag ook in localStorage. Lights-lijst staat klaar in het formaat (nog niet bewerkbaar).</p> |
| 81 | </aside> |
| 82 | <main> |
| 83 | <canvas id="grid"></canvas> |
| 84 | </main> |
| 85 | <script src="editor.js"></script> |
| 86 | <script>EditorApp.start();</script> |
| 87 | </body> |
| 88 | </html> |