Overlays
Want the powerful flexibility of ImGui for a simple text overlay? Here's how.
First make sure you've uncommented all of the plugin window code in the template's .h file. Then in your GUI file go to the render() function. For a custom overlay, you'll need to prepare flags for it to appear the way you want it to.
These are found at line 744 of imgui.h
Some useful flags for an overlay are:ImGuiWindowFlags_NoTitleBar removes the title barImGuiWindowFlags_NoScrollbar disables a scroll bar from appearingImGuiWindowFlags_AlwaysAutoResize automatically resizes the window to fit the contentImGuiWindowFlags_NoDecoration removes the scrollbar, title bar, and disables manual resizingImGuiWindowFlags_NoFocusOnAppearing prevents the overlay from stealing focus from other ImGui windowsImGuiWindowFlags_NoInputs makes the mouse pass right through the window to RLImGuiWindowFlags_NoBackground disables the background of the window
Here's an example of starting a window with some flags
ImGuiWindowFlags WindowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize
| ImGuiWindowFlags_NoFocusOnAppearing;
// If moveOverlay is true, the user can move the overlay
// When false the overlay window no longer accepts input
// I find this useful to connect to a CVar and checkbox in the plugin's settings
// You can allow a user to move the overlay only when they want
if (!moveOverlay) {
WindowFlags |= ImGuiWindowFlags_NoInputs;
}
// creates the window with the given flags
if (!ImGui::Begin(menuTitle_.c_str(), &isWindowOpen_, WindowFlags))
{
ImGui::End();
return;
}
// Do your overlay rendering with full ImGui here!
If you don't want the overlay to close when a user presses esc, change this function to return false
bool PluginName::IsActiveOverlay() {
return false;
}