/* catcrafts.net Copyright (C) 2026 Catcrafts The source code of this website is made available for viewing purposes only. No permission is granted to copy, modify, distribute, or create derivative works. */ import Catcrafts; import Crafter.Graphics; import std; using namespace Catcrafts; using namespace Crafter; int main() { Device::Initialize(); // Window in CRAFTER_GRAPHICS_WINDOW_DOM mode is a page-level event hub // plus the rAF driver; even without subscribing to its events we need // it so StartSync() can keep the wasm module alive past main() (the // bridge stashes a raw pointer, so the storage has to outlive main). // The dimensions are a hint only — the JS bridge sizes the render // surface to the canvas (full viewport, or the mount element). static Window window(1280, 720, "Catcrafts"); // Build the ray-tracing pipeline + scene now (runs StartInit/FinishInit). // The render canvas starts hidden; the demo only traces once a route // mounts it into #webgpu-demo (see Catcrafts:Demo). SetupDemo(window); InitializePage(); Router::AddPopStateListener([]{ RenderRoot(Router::GetPath()); }); static Dom::HtmlElementPtr blogButton("blog-nav-button"); blogButton.AddClickListener([](Dom::MouseEvent) { Router::PushState("{}", "", "/blog"); RenderRoot("/blog"); }); RenderRoot(Router::GetPath()); window.Render(); window.StartUpdate(); window.StartSync(); return 0; }