Skip to content

ImGui#

Defined in ImGui.hpp. Menu widgets for plugin settings. Call these from on_menu().

All functions are in the xenon::ImGui namespace. These are thin wrappers around the host's menu system, not the full Dear ImGui library.

CollapsingHeader#

bool ImGui::CollapsingHeader(const char* label);

Creates a collapsible section. Returns true when expanded.

Parameter Type Description
label const char* Header text
if (ImGui::CollapsingHeader("My Settings"))
{
    // Widgets here only show when expanded
    ImGui::Checkbox("Enabled", &enabled);
}

Tip

Always wrap your menu widgets inside a CollapsingHeader. This keeps the plugin list organized.


Checkbox#

bool ImGui::Checkbox(const char* label, bool* value);

Displays a checkbox. Modifies *value when toggled. Returns true if the value changed.

Parameter Type Description
label const char* Checkbox label
value bool* Pointer to the boolean state
static bool showEsp = true;
ImGui::Checkbox("Show ESP", &showEsp);

SliderFloat#

bool ImGui::SliderFloat(const char* label, float* value, float min, float max);

Float slider. Returns true if the value changed.

Parameter Type Description
label const char* Slider label
value float* Pointer to the float value
min float Minimum value
max float Maximum value
static float fov = 60.f;
ImGui::SliderFloat("FOV", &fov, 10.f, 180.f);

SliderInt#

bool ImGui::SliderInt(const char* label, int32_t* value, int32_t min, int32_t max);

Integer slider. Returns true if the value changed.

Parameter Type Description
label const char* Slider label
value int32_t* Pointer to the integer value
min int32_t Minimum value
max int32_t Maximum value
static int32_t thickness = 2;
ImGui::SliderInt("Thickness", &thickness, 1, 10);

Combo#

bool ImGui::Combo(const char* label, int32_t* currentItem, const char* items);

Dropdown selector. Returns true if the selection changed.

Parameter Type Description
label const char* Combo label
currentItem int32_t* Pointer to the selected index (0-based)
items const char* Null-separated item list
static int32_t mode = 0;
ImGui::Combo("Mode", &mode, "Head\0Body\0Nearest\0");

Items must be null-separated

The items string uses null bytes (\0) as separators, not commas or newlines. This is different from a C array of strings.

// CORRECT:
ImGui::Combo("Mode", &mode, "Option A\0Option B\0Option C\0");

// WRONG — will not work:
const char* modes[] = {"Option A", "Option B"};
ImGui::Combo("Mode", &mode, modes, 2);  // Not supported

Text#

void ImGui::Text(const char* text);

Displays a static text label.

Parameter Type Description
text const char* The text to display
ImGui::Text("Plugin version 1.0");

Tooltip#

void ImGui::Tooltip(const char* text);

Shows a tooltip on the previously drawn widget when hovered.

Parameter Type Description
text const char* Tooltip text
ImGui::Checkbox("Visible Only", &visibleOnly);
ImGui::Tooltip("Only show enemies that are not behind walls");

Separator#

void ImGui::Separator();

Draws a horizontal line to visually separate sections.

ImGui::Checkbox("Option A", &a);
ImGui::Checkbox("Option B", &b);
ImGui::Separator();
ImGui::SliderFloat("Range", &range, 0.f, 100.f);

Hotkey#

bool ImGui::Hotkey(const char* label, uint32_t* value);

Hotkey binding widget. The user clicks the widget and presses a key to bind it. Returns true if the binding changed.

Parameter Type Description
label const char* Widget label
value uint32_t* Pointer to the virtual key code
static uint32_t toggleKey = VK::Insert;
ImGui::Hotkey("Toggle Key", &toggleKey);

// Then in on_frame:
if (IsKeyDown(toggleKey))
    enabled = !enabled;

ColorSliders#

bool ImGui::ColorSliders(const char* label, Color* color);

Displays 4 integer sliders (R, G, B, A) for editing a Color. Returns true if any channel changed.

Parameter Type Description
label const char* Base label (suffixed with " R", " G", " B", " A")
color Color* Pointer to the color to edit
static Color g_enemyColor(255, 0, 0);
ImGui::ColorSliders("Enemy", &g_enemyColor);

This replaces the common pattern of declaring 4 separate int32_t variables and 4 SliderInt calls.