How sudoevolve/eui-neo works
Purpose and public entry points
EUI-NEO is a C++17 cross-platform retained UI framework for native desktop-style applications. Consumers include eui_neo.h or focused facades under include/eui/, define DSL composition, and configure an executable through CMake. Public app/window contracts are in include/eui/app.h, include/eui/dsl_app.h, and include/eui/window.h.
Application bootstrap and window loop
eui_neo_configure_app() selects and supplies a platform main/loop; applications normally provide app::dslAppConfig() and app::compose(). The runtime owns window creation, frame pacing, event polling, and lifecycle dispatch through core/app/app_runner.h, core/app/glfw_app_main.cpp, and core/app/sdl2_app_main.cpp. Windowing is isolated behind core/window/window_backend.h and core/window/window_input_backend.cpp, allowing GLFW or SDL2 integration without exposing either to application composition.
Declarative UI and retained runtime
The DSL builds a keyed UI tree with layout, state bindings, event handlers, and primitive-producing components. Its public/internal boundary is include/eui/dsl.h, core/dsl.h, and core/dsl_runtime.h. Runtime stages are factored by concern: lifecycle/instance reconciliation, geometry/layout, hit testing/input, animation/update/dirty tracking, then rendering in core/runtime/runtime_lifecycle.h, core/runtime/runtime_geometry.h, and core/runtime/runtime_render.h. Stable identifiers and retained instances enable incremental updates rather than rebuilding rendering state wholesale.
Components and application composition
Reusable widgets are header-level DSL compositions, not a separate widget runtime: components/components.h, components/input.h, and components/virtuallist.h. Larger examples exercise the framework as normal native apps, notably apps/gallery/app.cpp, apps/calgary_gallery/app.cpp, and apps/serial_tool/app.cpp. Optional integrations remain separate modules with their own build boundaries, such as modules/keyboard/keyboard.h and modules/serial/serial.cpp.
Render abstraction and GPU backends
Runtime rendering emits backend-neutral primitives, images, text, and surfaces via core/render/primitive.h, core/render/render_backend.h, and core/render/render_surface.h. OpenGL implements the default path in core/render/opengl/opengl_backend.cpp, including text, images, primitives, and Shadertoy. Vulkan is a parallel backend with explicit shaders and cache support in core/render/vulkan/vulkan_backend.cpp, core/render/vulkan/vulkan_cache.cpp, and core/render/vulkan/shaders/rounded_rect.frag. This boundary is the primary portability seam between UI/runtime logic and GPU APIs.
Assets, text, images, and shader content
Text/image resources become render-layer objects through core/render/text.h, core/render/image_source.h, and core/render/shadertoy.h. The framework bundles fonts and shader assets under assets/; Shadertoy configurations are parsed and represented by core/render/shadertoy_json.cpp and core/render/shadertoy_primitive.h. Build scripts generate Vulkan SPIR-V/header artifacts and wrap Shadertoy resources: scripts/generate_vulkan_shaders.py and scripts/EuiShaderToy.cmake.
Platform services and dependencies
Platform-facing capabilities—async work, JSON, networking, native/IME bridges, system tray, and performance data—are exposed through public facades and implemented behind core/platform/: include/eui/async.h, core/platform/network.cpp, and core/platform/native_bridge.c. Major vendored infrastructure includes GLFW/SDL2-facing window support, OpenGL loading (3rd/glad), FreeType text rasterization (3rd/freetype), image decoding via stb/libpng, JSON via yyjson, and markdown via md4c. The top-level build is CMake-driven (CMakeLists.txt) with an alternative Xmake build (xmake.lua); GitHub Actions handles CI, pages, and releases.
Main entry points: render_backend.h Render abstraction · app_runner.h App runner · app.h App and window API · dsl.h DSL facade
Components 20
Public API
- App and window API
include/eui/app.h - DSL facade
include/eui/dsl.h - Composable widgets · Header-level DSL compositions rather than a separate widget runtime.
components/components.h
UI Runtime
- App runner · Owns lifecycle dispatch, polling, pacing, and window creation.
core/app/app_runner.h - GLFW / SDL2 mains
core/app/glfw_app_main.cpp - Window input boundary
core/window/window_backend.h - Retained DSL runtime · Maintains keyed instances, bindings, handlers, and incremental state.
core/dsl_runtime.h - Lifecycle and instances
core/runtime/runtime_lifecycle.h - Layout and input · Calculates geometry and hit testing.
core/runtime/runtime_geometry.h - Render and dirty stage
core/runtime/runtime_render.h
Rendering
- Render abstraction · Carries primitives, images, text, and surfaces to GPU backends.
core/render/render_backend.h - OpenGL backend · Default renderer for primitives, text, images, and Shadertoy.
core/render/opengl/opengl_backend.cpp - Vulkan backend and cache
core/render/vulkan/vulkan_backend.cpp - Text, image, Shadertoy
core/render/shadertoy.h - Shader asset generation · Generates Vulkan artifacts and wraps Shadertoy resources.
scripts/generate_vulkan_shaders.py
Platform & Extensions
- Platform services · Async, networking, native bridges, and system capabilities.
core/platform/network.cpp - Optional integrations
modules/serial/serial.cpp
Other components
- Native application · Defines app composition and links the framework.
- CMake build
CMakeLists.txt - Example applications
apps/gallery/app.cpp
Connections 22
- Native application → App and window API: implements app contract
- Native application → DSL facade: composes UI
- Native application → CMake build: configures executable
- CMake build → GLFW / SDL2 mains: selects platform entry
- App and window API → App runner: starts
- GLFW / SDL2 mains → App runner: drives loop
- App runner → Window input boundary: creates windows and polls input
- DSL facade → Retained DSL runtime: builds keyed tree
- Composable widgets → DSL facade: composes with
- Retained DSL runtime → Lifecycle and instances: reconciles
- Lifecycle and instances → Layout and input: updates instances
- Window input boundary → Layout and input: input events
- Layout and input → Render and dirty stage: geometry and hit state
- Render and dirty stage → Render abstraction: emits primitives
- Text, image, Shadertoy → Render abstraction: supplies render objects
- Render abstraction → OpenGL backend: default backend
- Render abstraction → Vulkan backend and cache: parallel backend
- Shader asset generation → Vulkan backend and cache: generates SPIR-V artifacts
- Platform services → App runner: supports runtime
- Optional integrations → Platform services: extend platform capabilities
- Example applications → App and window API: uses
- Example applications → Composable widgets: uses