Skip to content

CPlusPlus

Patrick Dawson edited this page May 6, 2024 · 10 revisions

Compatible with both C++ modules and GDExtensions.

You need to:

  • Add [path to your project]/addons/imgui-godot/include to your include path
  • Add your own copy of the Dear ImGui sources, using the exact same commit that imgui-godot was built with
  • Build everything with -DIMGUI_USER_CONFIG="imconfig-godot.h"

For GDExtension:

  • Call ImGui::Godot::SyncImGuiPtrs() in a _ready() method or similar, before calling any ImGui function. It only needs to be called once, but it's safe to do so multiple times.
  • It is not safe to call this in your module initializer.

For modules:

  • Add the macro IMGUI_GODOT_MODULE_INIT() in exactly one of your source files. This exports a function that imgui-godot calls to synchronize the ImGui contexts.
Clone this wiki locally