| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
ImGuiX is an object-oriented framework built on top of Dear ImGui.
It provides a modular architecture for building complex, multi-window UIs with:
Unlike raw ImGui, where UI is typically coded in a single function, ImGuiX introduces
controllers, lifecycle hooks, and a window manager.
This makes it easier to organize large applications, reuse components, and test logic
independently of rendering.
Note: ImGuiX keeps the immediate-mode philosophy of Dear ImGui,
but structures it with OOP, an event bus, and an MVC-like architecture.
See Architecture for details.
For the Russian version, see README-RU.md.
Minimal ImGuiX application with a single framed window and controller:
#define IMGUIX_HEADER_ONLY
#define IMGUIX_DEMO
#include <imguix/core.hpp>
#include <imguix/windows/ImGuiFramedWindow.hpp>
#include <imguix/controllers/ExtendedController.hpp>
class HelloController : public ImGuiX::Controllers::ExtendedController {
public:
using ExtendedController::ExtendedController;
void drawUi() override {
ImGui::Begin("Hello");
ImGui::Text("It works!");
ImGui::End();
}
};
class HelloWindow : public ImGuiX::Windows::ImGuiFramedWindow {
public:
using ImGuiFramedWindow::ImGuiFramedWindow;
void onInit() override {
createController<HelloController>();
create(800, 600);
}
};
int main() {
ImGuiX::Application app;
app.createWindow<HelloWindow>("main", "ImGuiX Quick Start");
app.run();
return 0;
}A minimal example (Release, SFML backend by default) builds and installs the SDK into dist/sdk-sfml:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release ^
-DIMGUIX_SDK_INSTALL=ON -DIMGUIX_SDK_BUNDLE_DEPS=ON ^
-DCMAKE_INSTALL_PREFIX=%CD%/dist/sdk-sfml
cmake --build build --target install --config ReleaseKey options:
Note. In BUNDLED mode or if a dependency is built as a submodule and has its own install(...), its headers/libraries are installed automatically—we account for that and do not duplicate installation manually.
# External CMake project
cmake_minimum_required(VERSION 3.18)
project(MyApp CXX)
# Tell CMake where the SDK (with lib/cmake/*) resides
list(PREPEND CMAKE_PREFIX_PATH "path/to/sdk-sfml")
# 1) Main library
find_package(ImGuiX CONFIG REQUIRED) # provides target ImGuiX::imguix
# 2) Backend and its dependencies
find_package(SFML CONFIG REQUIRED COMPONENTS System Window Graphics)
# ImGui-SFML static library is installed to SDK/lib (headers in SDK/include).
# Import it as a regular library:
find_library(IMGUI_SFML_LIB NAMES ImGui-SFML PATHS ${CMAKE_PREFIX_PATH} PATH_SUFFIXES lib REQUIRED)
add_executable(myapp main.cpp)
target_link_libraries(myapp PRIVATE ImGuiX::imguix ${IMGUI_SFML_LIB} SFML::Graphics SFML::Window SFML::System)# The top-level project has its own dependencies (example):
find_package(fmt CONFIG REQUIRED)
set(IMGUIX_DEPS_MODE SYSTEM CACHE STRING "" FORCE) # forbid our submodule from pulling bundled deps
add_subdirectory(external/ImGuiX)
target_link_libraries(myapp PRIVATE ImGuiX::imguix)The SDK can include a quickstart/ folder with a minimal application example. Copy the quickstart directory into your project or add it as sources, build, and you're ready to go.
For practical window usage and configuration details, use:
. ├── include/ # public headers │ └── imguix/ # main library headers │ ├── config/ # configuration helpers │ ├── controllers/ # controller utilities │ ├── core/ # core framework modules │ │ ├── application/ # application and context │ │ ├── controller/ # base controller class │ │ ├── events/ # built-in event types │ │ ├── fonts/ # font manager │ │ ├── i18n/ # internationalization │ │ ├── model/ # model base classes │ │ ├── notify/ # notifications │ │ ├── options/ # options storage │ │ ├── pubsub/ # event bus │ │ ├── resource/ # resource registry │ │ ├── themes/ # theme manager │ │ └── window/ # window interfaces │ ├── extensions/ # utility extensions │ ├── themes/ # built-in themes │ ├── utils/ # utility functions │ ├── widgets/ # reusable widgets │ └── windows/ # window helpers ├── docs/ # project documentation ├── examples/ # sample applications │ └── quickstart/ # minimal starter project ├── libs/ # bundled dependencies ├── src/ # library sources └── tests/ # tests and demos
See docs/ARCHITECTURE.md for a full overview (Russian version: docs/ARCHITECTURE-RU.md).
ImGuiX combines the Immediate Mode GUI paradigm with classical design patterns:
Immediate-Mode MVC
Event-driven communication
The built-in EventBus implements a Publisher–Subscriber pattern.
Controllers and models exchange messages without direct dependencies.
Helpers like EventMediator simplify subscriptions, while EventAwaiter supports
one-shot waits and timeouts.
Lifecycle / Template Method
Windows and controllers expose hooks (onInit, drawContent, drawUi, …) that are
invoked by the application loop, giving a consistent structure for initialization,
per-frame logic, and cleanup.
Factories
Controllers and models are created through factory methods.
WindowInstance exposes createController<T>() which provides only a restricted
WindowInterface&, preserving invariants.
Strategies / Extensibility
Themes, fonts, and widgets can be registered dynamically, following a Strategy-like
pattern for appearance and behavior.
graph TD
A[Application]
WM[WindowManager]
W[WindowInstance]
C[Controller]
M[Model]
EB[EventBus]
RR[ResourceRegistry]
A-->WM
A-->M
A-->EB
A-->RR
WM-->W
W-->C
C-->EB
M-->EB
C-->RR
M-->RR
sequenceDiagram
participant Model
participant EventBus
participant Controller
Model->>EventBus: notifyAsync(Event)
Note right of EventBus: queued
EventBus-->>EventBus: process()
EventBus->>Controller: notify(Event)
The HTML template for the Web build lives in assets and is included in quickstart/ when IMGUIX_SDK_INSTALL_QUICKSTART is enabled. Tests do not need it—assets/data/web is excluded when copying assets for tests.
To build ImGuiX for WebAssembly using SDL2 and OpenGL ES 2.0, use emcc (from the Emscripten SDK).
To avoid hardcoding paths to the SDK and build directory, an emsdk-path.txt file in the repository root is used. The scripts build-test-sdl2-ems.bat and run-test-sdl2-ems.bat read it automatically.
File format:
D:/tools/emsdk
D:/repo/ImGuiX/build-test-sdl2-emsbuild-test-sdl2-ems.bat :: builds the sample and places index.html in the specified folder
run-test-sdl2-ems.bat :: launches emrun on a local serverAfter building, open http://localhost:8081/index.html in your browser.
ImGuiX checks several macros to toggle optional integrations. They are defined automatically when corresponding CMake options are enabled.
See docs/CONFIGURATION.md for other configuration macros.
ImGuiX ships with built-in color themes and supports custom ones. Register and apply a theme:
auto& tm = themeManager();
ImGuiX::Themes::registerCorporateGreyTheme(tm);
tm.setTheme(IMGUIX_THEME_CORPORATE_GREY);Widgets manage theme choice and persistence:
ImGuiX::Widgets::ApplyStoredTheme(this);
ImGuiX::Widgets::ThemePicker("demo.theme", this);See docs/THEMES.md for the full API and theme list.
ImGuiX uses ImGuiX::I18N::LangStore for localized strings, markdown docs, formatting, and plural forms.
Quick pointers:
How to configure plural rules:
See docs/I18N-GUIDE.md for full workflow and examples.
ImGuiX ships with a FontManager that can auto-load fonts from a JSON config or be configured manually. By default, fonts are read from data/resources/fonts/fonts.json. For full details see docs/FONTS-GUIDE.md (RU: docs/FONTS-GUIDE-RU.md).
Quick usage:
Supported preset tokens (add to your preset string):
Note. Ranges only open codepoints in the atlas; you still need a font that actually contains these glyphs (e.g., a symbols-capable TTF).
Tip. Icon fonts (Material, Font Awesome/Fork Awesome, etc.) use the Private Use Area (PUA) codepoints. Include PUA in preset ranges so icons render alongside text.
Warning. Each extra range and merged font increases atlas texture size and glyph count. Keep the atlas reasonable (≈4–8 MB). Check after fontsBuildNow() via Metrics/Debugger → Fonts or programmatically (io.Fonts->TexWidth, TexHeight).
An example manual setup in WindowInstance::onInit():
fontsBeginManual();
fontsSetRangesPreset("Default+Punct+PUA+LatinExtA");
fontsAddBody({ "Roboto-Medium.ttf", 16.0f });
fontsAddMerge(ImGuiX::Fonts::FontRole::Icons,
{ "forkawesome-webfont.ttf", 16.0f, 0.0f, true });
fontsAddHeadline(ImGuiX::Fonts::FontRole::H1, { "Roboto-Bold.ttf", 24.0f });
fontsBuildNow();FontFile positional fields:
Tip: For Western European languages (French, Polish, Czech, etc.) it is recommended to add +LatinExtA since characters like œ/Œ are located in the Latin Extended-A block. You may also include +Latin1Sup, +LatinExtB, or +LatinExtAdditional if your target locale requires them.
This repository bundles third-party fonts under their original licenses:
Noto Sans (Latin/Cyrillic/Greek/Vietnamese), Noto Sans CJK (SC/TC/JP/KR), Noto Sans Arabic / Devanagari / Thai — licensed under the SIL Open Font License 1.1. Copyright © The Noto Project Authors.
Font Awesome Free (fonts only), Fork Awesome, Fontaudio — SIL Open Font License 1.1. Note: brand icons remain subject to trademark rights.
Material Icons, Roboto — Apache License 2.0 (see also licenses/NOTICE if provided upstream).
All fonts are included unmodified. See THIRD-PARTY-NOTICES.md for per-family attributions.
ImGuiX bundles several upstream libraries as git submodules:
MIT — see LICENSE
| Back | FazBrowse Home | New Git URL |