3 minutes
imogui - draw on overlays using imgui
imogui is my GUI library to hook existing overlays and draw on them using imgui. All of imgui’s powerfull widgets such as buttons, plots and colorpickers can be used to create an interactive extension to any program using one of the supported overlays. This is very convenient as some of the supported overlays allow to add to any third party application (such as Steam). This project uses hookFTW to hook into the drawing function of the target overlay to achieve its functionality.
Using imogui
Additionally to imgui widgets it is also possible to draw several primitives using the passed imogui::Renderer inside the provided OnDraw callback. Here is an example using the Steam overlay in a 64-bit DirectX 11 game:
void OnDraw(imogui::Renderer* renderer)
{
// use the renderer to draw anything
[...]
renderer->RenderCircle(bouncyballs[i].pos, bouncyballs[i].radius, bouncyballColor, i % 8, 32);
static bool openOverlay = true;
// create an imgui window to interact (choose bouncy ball color in this case)
if (ImGui::Begin("IMOGUI - Hook", &openOverlay))
{
ImGui::Text("Intermediate Mode Overlay GUI");
ImGui::ColorPicker3("Bouncyball Color", color);
bouncyballColor = ImGui::ColorConvertFloat4ToU32(ImVec4(color[2], color[1], color[0], 1.f));
}
ImGui::End();
}
imogui::Steamoverlay steamOverlay;
steamOverlay.Hook(imogui::renderapi::directx11, OnDraw);
After compiling it into a DLL and loading it into the target process (here: Rocket League) using a DLL injector, this is the result: The purple discs and two open menus are usually not part of the game.
Unhooking imogui allows to modify your projects code and reinject your modified DLL during initial development (or if your usecase demands it) and is just as easy:
steamOverlay.Unhook();
Note that this library is not limited to be used with games only. It works with any software employing one of the supported rendering APIs.
Currently supported overlays
32 Bit
Overlay | OpenGL | DirectX 9 | DirectX 11 | DirectX 12 |
---|---|---|---|---|
Steam | ❌ | ✅ | ❌ | ❌ |
Discord | ❌ | ✅ | ❌ | ❌ |
Origin | ❌ | ❌ | ❌ | ❌ |
MSI Afterburner | ❌ | ❌ | ❌ | ❌ |
Overwolf | ❌ | ❌ | ❌ | ❌ |
GeForce Experience | ❌ | ❌ | ❌ | ❌ |
OBS | ❌ | ✅ | ❌ | ❌ |
64 Bit
Overlay | OpenGL | DirectX 9 | DirectX 11 | DirectX 12 |
---|---|---|---|---|
Steam | ❌ | ❌ | ✅ | ❌ |
Discord | ❌ | ❌ | ✅ | ❌ |
Origin | ❌ | ❌ | ✅ | ❌ |
MSI Afterburner | ❌ | ❌ | ✅ | ❌ |
Overwolf | ❌ | ❌ | ❌ | ❌ |
GeForce Experience | ❌ | ❌ | ❌ | ❌ |
OBS | ❌ | ❌ | ✅ | ❌ |
Roadmap
As you can see in the table above there are numerous overlays and rendering APIs that are yet to be supported by this project. If anyone is interested in contributing to the project I’m more than happy to assist. These are the features I’m most exited about currently:
- Add support for OpenGL
- Add support for DirectX 12
- Add support for Vulkan
- Add more overlays