Fast, flexible and simple GUI.
See the code
MyGUI is a cross-platform library for creating graphical user interfaces (GUIs) for games and 3D applications. It is written in C++17 and is designed to be fast, flexible, and easy to integrate with various rendering engines.
Online demos | Showcase | Projects using MyGUI
AutoDpi, on by default); set
Gui::setDpiScale() before initialise() to control the scale, or use the
DpiScale property in font XML for a manual override. setDpiScale() can
also be used to scale the entire GUI uniformly without touching the OS DPI.
Fonts are re-rasterized at the scaled size, so they remain pixel-perfect.SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) before creating the windowSDL_WINDOW_ALLOW_HIGHDPI and initialize the rendering contextdpiScale: Windows uses SDL_GetDisplayDPI() / 96.0f; macOS uses
pixel width (SDL_GetWindowSizeInPixels()) divided by window width (SDL_GetWindowSize())Gui::setDpiScale(dpiScale) before Gui::initialise()dpiScale on Windows; keep them unchanged on macOS.
Use these logical dimensions for setViewSize() and drawable pixels for the rendering viewport.| Backend | CMake ID |
|---|---|
| Dummy (no-op) | 1 |
| Ogre | 3 |
| OpenGL | 4 |
| Direct3D 9 | 5 |
| Direct3D 11 | 6 |
| OpenGL 3.x | 7 |
| OpenGL ES 3 / WebGL 2 (Emscripten) | 8 |
| OgreNext | 9 |
| Vulkan | 10 |
| OpenSceneGraph | 11 |
Select a backend with the -DMYGUI_RENDERSYSTEM=<id> CMake option.
git clone https://github.com/MyGUI/mygui.git
cd mygui
cmake -S . -B build -DMYGUI_RENDERSYSTEM=7
cmake --build build
After installing MyGUI, use it from your CMake project with modern targets:
find_package(MyGUI REQUIRED)
target_link_libraries(myapp PRIVATE MyGUI::MyGUI MyGUI::OgrePlatform)
Available targets:
| Target | Description |
|---|---|
MyGUI::MyGUI | Core library |
MyGUI::OgrePlatform | Ogre backend |
MyGUI::OpenGLPlatform | OpenGL backend |
MyGUI::OpenGL3Platform | OpenGL 3.x backend |
MyGUI::OpenGLESPlatform | OpenGLES backend (Emscripten) |
MyGUI::DirectXPlatform | Direct3D 9 backend |
MyGUI::DirectX11Platform | Direct3D 11 backend |
MyGUI::OgreNextPlatform | OgreNext backend |
MyGUI::VulkanPlatform | Vulkan backend |
MyGUI::OsgPlatform | OpenSceneGraph backend |
For OgreNext, add its installation prefix to CMAKE_PREFIX_PATH when configuring the consumer, or set OGRE_DIR.
Build options:
| Option | Default | Description |
|---|---|---|
MYGUI_RENDERSYSTEM | 7 (OpenGL 3.x) | Render backend |
MYGUI_USE_FREETYPE | ON | Enable FreeType font rendering |
MYGUI_MSDF_FONTS | OFF | Enable MSDF font support |
MYGUI_BUILD_DEMOS | ON | Build demo applications |
MYGUI_BUILD_ADVANCED_DEMOS | ON | Build advanced demo applications |
MYGUI_BUILD_TOOLS | ON | Build layout/skin/font/image editors |
MYGUI_BUILD_UNITTESTS | ON | Build headless unit tests |
MYGUI_BUILD_WRAPPER | OFF | Build C# bindings (Windows only) |
MYGUI_BUILD_TEST_APP | OFF | Build test application |
MyGUI ships with several visual editors under Tools/:
.layout XML files)ResourceTrueTypeFont XML into a ResourceManualFont XML + PNG
atlas pair. Useful for re-baking fonts from source without launching a GUI editor.Run tests with ctest --test-dir build -C RelWithDebInfo --output-on-failure (use your build configuration).
Run python3 Scripts/Tests/test_install.py to build, install, relocate, and run an OpenGL3 platform consumer without creating a
graphics context. Add --static to test static linking or --rendersystem <ID> to select another backend. CI uses
--skip-build --build-dir build to reuse its existing build; installation, relocation, and the consumer test always run.
Run python3 Scripts/Tests/compare_screenshots.py build to compare demos and tools screenshots against reference images,
checking rendering consistency across platforms and render backends. Requires built applications, a graphical display,
and NumPy/Pillow (python3 -m pip install numpy pillow).
MacOS OpenGL and DirectX require --tolerance 1 due to rounding specifics not related to MyGUI.
cmake --build build --target api-docs (requires Doxygen)This project uses clang-format to enforce a consistent C++ code style. Before committing, run the formatting check:
Scripts/run-clang-format.py
Use --dry to not change any files and only see formatting issues:
To run the check automatically on every commit, install pre-commit:
pip install pre-commit
pre-commit install
The pre-commit hook is optional — it skips automatically if clang-format is not installed.
This project is licensed under the MIT License — see COPYING.MIT for details.
140 followers · starred Jul 2023
234 followers · starred Jul 2025
140 followers · starred Sep 2016
392 followers · starred Mar 2023
Fast, flexible and simple GUI.
See the code
MyGUI is a cross-platform library for creating graphical user interfaces (GUIs) for games and 3D applications. It is written in C++17 and is designed to be fast, flexible, and easy to integrate with various rendering engines.
Online demos | Showcase | Projects using MyGUI
AutoDpi, on by default); set
Gui::setDpiScale() before initialise() to control the scale, or use the
DpiScale property in font XML for a manual override. setDpiScale() can
also be used to scale the entire GUI uniformly without touching the OS DPI.
Fonts are re-rasterized at the scaled size, so they remain pixel-perfect.SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) before creating the windowSDL_WINDOW_ALLOW_HIGHDPI and initialize the rendering contextdpiScale: Windows uses SDL_GetDisplayDPI() / 96.0f; macOS uses
pixel width (SDL_GetWindowSizeInPixels()) divided by window width (SDL_GetWindowSize())Gui::setDpiScale(dpiScale) before Gui::initialise()dpiScale on Windows; keep them unchanged on macOS.
Use these logical dimensions for setViewSize() and drawable pixels for the rendering viewport.| Backend | CMake ID |
|---|---|
| Dummy (no-op) | 1 |
| Ogre | 3 |
| OpenGL | 4 |
| Direct3D 9 | 5 |
| Direct3D 11 | 6 |
| OpenGL 3.x | 7 |
| OpenGL ES 3 / WebGL 2 (Emscripten) | 8 |
| OgreNext | 9 |
| Vulkan | 10 |
| OpenSceneGraph | 11 |
Select a backend with the -DMYGUI_RENDERSYSTEM=<id> CMake option.
git clone https://github.com/MyGUI/mygui.git
cd mygui
cmake -S . -B build -DMYGUI_RENDERSYSTEM=7
cmake --build build
After installing MyGUI, use it from your CMake project with modern targets:
find_package(MyGUI REQUIRED)
target_link_libraries(myapp PRIVATE MyGUI::MyGUI MyGUI::OgrePlatform)
Available targets:
| Target | Description |
|---|---|
MyGUI::MyGUI | Core library |
MyGUI::OgrePlatform | Ogre backend |
MyGUI::OpenGLPlatform | OpenGL backend |
MyGUI::OpenGL3Platform | OpenGL 3.x backend |
MyGUI::OpenGLESPlatform | OpenGLES backend (Emscripten) |
MyGUI::DirectXPlatform | Direct3D 9 backend |
MyGUI::DirectX11Platform | Direct3D 11 backend |
MyGUI::OgreNextPlatform | OgreNext backend |
MyGUI::VulkanPlatform | Vulkan backend |
MyGUI::OsgPlatform | OpenSceneGraph backend |
For OgreNext, add its installation prefix to CMAKE_PREFIX_PATH when configuring the consumer, or set OGRE_DIR.
Build options:
| Option | Default | Description |
|---|---|---|
MYGUI_RENDERSYSTEM | 7 (OpenGL 3.x) | Render backend |
MYGUI_USE_FREETYPE | ON | Enable FreeType font rendering |
MYGUI_MSDF_FONTS | OFF | Enable MSDF font support |
MYGUI_BUILD_DEMOS | ON | Build demo applications |
MYGUI_BUILD_ADVANCED_DEMOS | ON | Build advanced demo applications |
MYGUI_BUILD_TOOLS | ON | Build layout/skin/font/image editors |
MYGUI_BUILD_UNITTESTS | ON | Build headless unit tests |
MYGUI_BUILD_WRAPPER | OFF | Build C# bindings (Windows only) |
MYGUI_BUILD_TEST_APP | OFF | Build test application |
MyGUI ships with several visual editors under Tools/:
.layout XML files)ResourceTrueTypeFont XML into a ResourceManualFont XML + PNG
atlas pair. Useful for re-baking fonts from source without launching a GUI editor.Run tests with ctest --test-dir build -C RelWithDebInfo --output-on-failure (use your build configuration).
Run python3 Scripts/Tests/test_install.py to build, install, relocate, and run an OpenGL3 platform consumer without creating a
graphics context. Add --static to test static linking or --rendersystem <ID> to select another backend. CI uses
--skip-build --build-dir build to reuse its existing build; installation, relocation, and the consumer test always run.
Run python3 Scripts/Tests/compare_screenshots.py build to compare demos and tools screenshots against reference images,
checking rendering consistency across platforms and render backends. Requires built applications, a graphical display,
and NumPy/Pillow (python3 -m pip install numpy pillow).
MacOS OpenGL and DirectX require --tolerance 1 due to rounding specifics not related to MyGUI.
cmake --build build --target api-docs (requires Doxygen)This project uses clang-format to enforce a consistent C++ code style. Before committing, run the formatting check:
Scripts/run-clang-format.py
Use --dry to not change any files and only see formatting issues:
To run the check automatically on every commit, install pre-commit:
pip install pre-commit
pre-commit install
The pre-commit hook is optional — it skips automatically if clang-format is not installed.
This project is licensed under the MIT License — see COPYING.MIT for details.
140 followers · starred Jul 2023
234 followers · starred Jul 2025
140 followers · starred Sep 2016
392 followers · starred Mar 2023