Lysa Nodes  0.0
Lysa Nodes — Scene Graph for the Lysa Engine
Application class

src/Main.cpp

With Lysa Nodes the Application class only needs the render() call and the main loop.

Constructor

Application():
lysa(contextConfiguration),
scene(std::make_unique<RotatingAssetScene>(window)) {
if (!lysa::ctx().fs.directoryExists("app://shaders")) {
lysa::Log::critical(
"'shaders' directory not found – run the application from the "
"project root or build the 'shaders' CMake target first.");
return;
}
}

RotatingAssetScene(window) wires everything: it adds all nodes, calls attach(window), and subscribes to engine events. After the constructor returns the scene is fully operational; the application needs no further setup.

Shaders directory validation happens in the constructor rather than run() to surface the error before the main loop starts.

run()

void Application::run() {
lysa::ctx().events.subscribe(
lysa::MainLoopEvent::PROCESS,
[&](const lysa::Event&) {
window.getRenderTarget().render();
});
lysa.run();
}

A single subscription calls render() after the scene tree has processed the frame. Event subscriptions fire in registration order (FIFO); because RotatingAssetScene::attach(window) was called during construction — before Application::run() — the scene's PROCESS handler is always invoked first.

Lifetime and destruction

After lysa::Lysa::run() returns (when lysa::ctx().exit is set to true by MainWindow on CLOSING), the Application destructor releases objects in reverse declaration order: scene, then window, then lysa. This ensures that GPU resources owned by the scene are released before the device is destroyed.

Next : What's next?