nightshade-editor 0.14.2

Interactive map editor for the Nightshade game engine
<!doctype html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <title>Nightshade Editor</title>
        <link data-trunk rel="copy-file" href="../../crates/nightshade/images/icon.png" />
        <link rel="icon" type="image/png" href="icon.png" />
        <base data-trunk-public-url />
        <style type="text/css">
            :focus {
                outline: none;
            }

            body,
            html {
                margin: 0;
                padding: 0;
                width: 100%;
                height: 100%;
                overflow: hidden;
                background: #0f0f12;
            }

            .root {
                width: 100%;
                height: 100%;
                display: flex;
                justify-content: center;
                align-items: center;
            }

            .main-canvas {
                display: block;
                width: 100%;
                height: 100%;
            }

            #loading {
                position: fixed;
                inset: 0;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                background: #0f0f12;
                color: #c8c8d0;
                font-family: system-ui, -apple-system, sans-serif;
                z-index: 100;
                opacity: 1;
                transition: opacity 0.4s ease;
                pointer-events: none;
            }

            #loading.hidden {
                opacity: 0;
            }

            .spinner {
                width: 56px;
                height: 56px;
                border: 4px solid rgba(255, 255, 255, 0.1);
                border-top-color: #818cf8;
                border-radius: 50%;
                animation: spin 0.85s linear infinite;
            }

            .loading-text {
                margin-top: 18px;
                font-size: 14px;
                letter-spacing: 0.05em;
            }

            @keyframes spin {
                to {
                    transform: rotate(360deg);
                }
            }
        </style>
    </head>

    <body>
        <link data-trunk rel="rust" href="Cargo.toml" data-target-name="nightshade-editor" />
        <div class="root">
            <canvas class="main-canvas" id="canvas"></canvas>
        </div>
        <div id="loading">
            <div class="spinner"></div>
            <div class="loading-text">Loading Nightshade...</div>
        </div>
        <script>
            function resizeCanvas() {
                const canvas = document.getElementById("canvas");
                const dpr = window.devicePixelRatio || 1;
                const width = window.innerWidth;
                const height = window.innerHeight;

                canvas.width = Math.round(width * dpr);
                canvas.height = Math.round(height * dpr);
                canvas.style.width = width + "px";
                canvas.style.height = height + "px";
            }
            resizeCanvas();
            window.addEventListener("resize", resizeCanvas);

            window.addEventListener("TrunkApplicationStarted", () => {
                const loading = document.getElementById("loading");
                if (loading) {
                    loading.classList.add("hidden");
                    setTimeout(() => loading.remove(), 500);
                }
            });
        </script>
    </body>
</html>