ImGui Integration Overview
ReXApp creates anImGuiDrawer instance that manages all ImGui rendering. Dialogs are registered with the drawer and automatically rendered each frame.
Built-in Overlays
ReXApp includes these debug overlays:- Console: Log output viewer (toggle with
`backtick key) - Debug Overlay: FPS, frame time, system stats
- Settings: Runtime configuration UI
Creating Custom Dialogs
Custom dialogs inherit fromrex::ui::ImGuiDialog and override the OnDraw() method.
Basic Dialog
rex/ui/imgui_dialog.h:27-59
Dialog Lifecycle Hooks
rex/ui/imgui_dialog.h:51-53
Registering Dialogs
Register dialogs in theOnCreateDialogs() hook:
rex/ui/imgui_drawer.h:44
Accessing ImGui Drawer
Access the drawer through the protected accessor:rex/rex_app.h:108
Advanced Dialog Examples
Interactive Settings Dialog
Real-time Data Display
Modal Dialog with Callback
Accessing Runtime from Dialogs
Dialogs often need access to Runtime subsystems. Pass the Runtime pointer through the constructor:Accessing ImGuiIO
TheImGuiIO structure provides input state and configuration:
rex/rex_app.h:96 for OnCreateDialogs signature
Message Boxes
For simple alerts, use the built-in message box:rex/ui/imgui_dialog.h:34-35
Removing Dialogs
Dialogs are typically removed by callingClose() from within the dialog:
rex/ui/imgui_drawer.h:45
Thread Safety
ImGui rendering happens on the main thread. The PPC module runs on a background thread. If your dialog needs to display data from the game thread, use proper synchronization:Complete Example
Here’s a complete application with multiple custom dialogs:Best Practices
Do
- Keep dialog logic simple and focused
- Use atomics or mutexes for shared state with game thread
- Pass Runtime pointer through constructor for subsystem access
- Use ImGui’s built-in layout and styling
- Call
Close()when dialog should be removed - Use message boxes for simple alerts
Don’t
- Don’t perform heavy computation in OnDraw (called every frame)
- Don’t access UI from the PPC module thread
- Don’t forget to handle window close (user clicking X)
- Don’t leak memory - dialogs are owned by ImGuiDrawer
- Don’t block the UI thread with long operations
ImGui Resources
For detailed ImGui API documentation:- ImGui GitHub
- ImGui Demo - comprehensive examples
- ImGui Manual
Next Steps
ReXApp Base Class
Learn about the application framework
Custom Hooks
Customize behavior with virtual hooks
Runtime Setup
Configure backend systems