This project demonstrates use of ClojureScript and UIx, together with React and a custom reconciler to drive a native GLFW window with Skia rendering library and Yoga layout via AOT compiled JavaScript with Static Hermes.
- Based off https://github.com/tmikov/imgui-react-runtime
- Read more about Static Hermes and imgui-react-runtime here
Differences from tmikov/imgui-react-runtime:
- Bundles UIx app written in ClojureScript
- Exposes
WebSocketinterface to JS env via libwebsockets, needed for REPL connection in dev - Supports hot-reloading cljs code in dev, via custom REPL client runtime
- Supports state preserving hot-reloading via react-refresh
- Runs
requestAnimationFrameat device's refresh rate (60/120/144hz etc) - Skia example includes Skia graphics rendered in GLFW window, with Yoga as flex box layout engine and DOM-like event propagation system
native dependencies + interpreted javascript for interactive development
- Install NPM dependencies
npm i - Run cljs dev build
clojure -M -m shadow.cljs.devtools.cli watch skia-app cd imgui-react-runtime- Configure hermes dev build
cmake -B cmake-build-debug -DCMAKE_BUILD_TYPE=Debug -G Ninja - Build
cmake --build cmake-build-debug --target skia - Run the binary
./cmake-build-debug/examples/skia/skia - Make changes in cljs files to trigger hot-reload or/and connect to REPL server (run
(shadow/repl :skia-app)from Clojure REPL to hook into JavaScript env)
native dependencies + native AOT compiled javascript for maximum performance
- Build cljs code
clojure -M -m shadow.cljs.devtools.cli release skia-app cd imgui-react-runtime- Configure hermes release build
cmake -B cmake-build-release -DCMAKE_BUILD_TYPE=Release -G Ninja - Build
cmake --build cmake-build-release --target skia - Run the binary
./cmake-build-release/examples/skia/skia
Output binary: 15MB
- 3MB Hermes VM
- 1.8MB React library
- 10.2MB app/renderer/GLFW/Skia/Yoga