Skip to content

Dear ImGui

ZSolarDev edited this page Nov 9, 2026 · 4 revisions

Hx4Diva comes with linc_imgui, a library for Dear ImGui in Haxe. You can also notice that it expands it, with imgui.ImGuiDx11, adding DirectX support as well as support with Hx4Diva, so that you can easily use ImGui in Project DIVA. The way it's specifically tailored towards Hx4Diva is that it recreates itself every time the swap chain changes via the OnSwapChain hook. It's simple to use:

Diva.hookManager.registerModHook(D3DInit((swapChain, device, deviceCtx) -> {
    ImGuiDx11.init(swapChain, device, deviceCtx);
}));
Diva.hookManager.registerModHook(OnFrame((swapChain) -> {
    ImGuiDx11.begin();
    // Draw ImGui from ImGui.__() here
    ImGuiDx11.end();
}));

To destroy ImGui, you can run ImGuiDx11.destroy(revive). The revive parameter is whether it should unregister the OnSwapChain hook. This is set to true while recreating itself in its OnSwapChain hook, but in most cases, you'd want to leave it blank so it can default to false, or pass in false.

Clone this wiki locally