|
| 1 | +# imgui |
| 2 | + |
| 3 | +C++23 module package for Dear ImGui on mcpp. |
| 4 | + |
| 5 | +This package uses `compat.imgui` for upstream Dear ImGui sources and provides |
| 6 | +module interfaces for the core API plus GLFW/OpenGL3 backend entry points. |
| 7 | + |
| 8 | +## Modules |
| 9 | + |
| 10 | +- `imgui.core` |
| 11 | + - Core Dear ImGui context, frame, widget, and draw-data APIs. |
| 12 | +- `imgui.backend.glfw` |
| 13 | + - GLFW platform backend plus a small GLFW window/context helper surface. |
| 14 | +- `imgui.backend.opengl3` |
| 15 | + - OpenGL3 renderer backend. |
| 16 | +- `imgui.backend.glfw_opengl3` |
| 17 | + - Convenience module that re-exports core, GLFW, and OpenGL3 backend modules |
| 18 | + and provides combined lifecycle helpers. |
| 19 | + |
| 20 | +## Dependencies |
| 21 | + |
| 22 | +The root package depends on: |
| 23 | + |
| 24 | +- `compat.imgui = "1.92.8"` |
| 25 | +- `compat.glfw = "3.4"` |
| 26 | +- `compat.opengl = "2026.05.31"` |
| 27 | + |
| 28 | +The repository does not vendor Dear ImGui sources. Source and header files come |
| 29 | +from compat packages through mcpp dependency metadata. |
| 30 | + |
| 31 | +## Quick Start |
| 32 | + |
| 33 | +```bash |
| 34 | +mcpp build |
| 35 | +mcpp test |
| 36 | +cd examples/basic |
| 37 | +mcpp run |
| 38 | +``` |
| 39 | + |
| 40 | +Expected headless example output: |
| 41 | + |
| 42 | +```text |
| 43 | +Dear ImGui 1.92.8 module frame ok |
| 44 | +``` |
| 45 | + |
| 46 | +## Backend Example |
| 47 | + |
| 48 | +The GLFW/OpenGL3 example builds on CI but should be run only in an environment |
| 49 | +with a working display and OpenGL context: |
| 50 | + |
| 51 | +```bash |
| 52 | +cd examples/glfw_opengl3 |
| 53 | +mcpp build |
| 54 | +mcpp run |
| 55 | +``` |
| 56 | + |
| 57 | +## Consumer Usage |
| 58 | + |
| 59 | +```toml |
| 60 | +[dependencies] |
| 61 | +imgui = "0.0.1" |
| 62 | +``` |
| 63 | + |
| 64 | +Then import the modules you need: |
| 65 | + |
| 66 | +```cpp |
| 67 | +import imgui.core; |
| 68 | +import imgui.backend.glfw_opengl3; |
| 69 | + |
| 70 | +int main() { |
| 71 | + ImGuiContext* context = ImGui::CreateContext(); |
| 72 | + ImGui::SetCurrentContext(context); |
| 73 | + ImGui::DestroyContext(context); |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +## Module Surface |
| 78 | + |
| 79 | +`src/core.cppm` wraps `imgui.h` through a global module fragment and exports a |
| 80 | +tested core API surface: |
| 81 | + |
| 82 | +- Types: `ImGuiContext`, `ImFontAtlas`, `ImGuiIO`, `ImDrawData`, `ImVec2`. |
| 83 | +- Functions: context lifecycle, `GetIO`, `NewFrame`, `Begin`, `Button`, |
| 84 | + `TextUnformatted`, `End`, `Render`, and `GetDrawData`. |
| 85 | + |
| 86 | +Backend modules adapt the official Dear ImGui backend headers internally and |
| 87 | +export explicit wrapper functions. Consumer code should only need module |
| 88 | +imports for the surfaces exposed by this package. |
| 89 | + |
| 90 | +## Verification |
| 91 | + |
| 92 | +The `0.0.1` release state is verified with mcpp `0.0.44`: |
| 93 | + |
| 94 | +- `mcpp build` |
| 95 | +- `mcpp test` |
| 96 | +- `cd examples/basic && mcpp run` |
| 97 | +- `cd examples/glfw_opengl3 && mcpp build` |
| 98 | + |
| 99 | +## License |
| 100 | + |
| 101 | +The wrapper code in this repository is MIT licensed. Dear ImGui is MIT licensed |
| 102 | +and provided by the `compat.imgui` package. |
0 commit comments