rewrite
Some checks failed
Deploy / build-deploy (push) Failing after 4m56s

This commit is contained in:
Jorijn van der Graaf 2026-08-05 04:18:37 +02:00
commit 934c94cb5c
50 changed files with 10464 additions and 758 deletions

View file

@ -22,27 +22,32 @@ int main() {
// surface to the canvas (full viewport, or the mount element).
static Window window(1280, 720, "Catcrafts");
// document.title is only reachable through Window::SetTitle, so give the
// router a way to set a per-route title without threading a Window
// through every render call.
SetActiveWindow(&window);
// Build the ray-tracing pipeline + scene now (runs StartInit/FinishInit).
// The render canvas starts hidden; the demo only traces once a route
// The render canvas starts hidden; it only traces once the /demo route
// mounts it into #webgpu-demo (see Catcrafts:Demo).
SetupDemo(window);
InitializePage();
Router::AddPopStateListener([]{
RenderRoot(Router::GetPath());
});
// Back/forward. The Router V1 callback carries no payload, so the route is
// re-read from window.location — which is the right thing regardless,
// since the location is the single source of truth for what should be on
// screen.
Router::AddPopStateListener([]{ RenderCurrentRoute(); });
static Dom::HtmlElementPtr blogButton("blog-nav-button");
blogButton.AddClickListener([](Dom::MouseEvent) {
Router::PushState("{}", "", "/blog");
RenderRoot("/blog");
});
RenderRoot(Router::GetPath());
RenderCurrentRoute();
window.Render();
window.StartUpdate();
// StartSync rather than StayAlive: /demo drives the ray tracer from the
// animation-frame loop, so the loop has to exist before that route is
// visited. A build of this site without the demo could call StayAlive
// instead and skip the permanent rAF tick entirely.
window.StartSync();
return 0;
}