Skip to content
Go bindings for the dear imgui immediate mode GUI library
C++ Go C
Branch: master
Clone or download
Armored Dragon Armored Dragon
Armored Dragon and Armored Dragon Strip **all** Im/ImGui/Gui prefixes now
Latest commit dfce6ea Aug 28, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
imgui @ 55a6209 SWIG + C++ imgui based version. Compiles, but doesn't link yet. Aug 25, 2017
sdl2_gl3
.gitignore Initial commit Aug 25, 2017
.gitmodules SWIG + C++ imgui based version. Compiles, but doesn't link yet. Aug 25, 2017
LICENSE Initial commit Aug 25, 2017
README.md
imconfig.h Working bindings! Aug 25, 2017
imgui.cpp Working bindings! Aug 25, 2017
imgui.go Strip **all** Im/ImGui/Gui prefixes now Aug 28, 2017
imgui.h Working bindings! Aug 25, 2017
imgui.i
imgui.yml Non working cgogen/c-for-go version Aug 25, 2017
imgui_demo.cpp Working bindings! Aug 25, 2017
imgui_draw.cpp
imgui_internal.h Working bindings! Aug 25, 2017
imgui_wrap.cxx
lib_pkg.go SWIG + C++ imgui based version. Compiles, but doesn't link yet. Aug 25, 2017
patch.sh Fix line endings in patch.sh Aug 28, 2017
stb_rect_pack.h Working bindings! Aug 25, 2017
stb_textedit.h Working bindings! Aug 25, 2017
stb_truetype.h Working bindings! Aug 25, 2017

README.md

go-imgui

Go bindings for the awesome dear imgui immediate mode GUI library, written in C++. These bindings are generated with SWIG.

Current imgui version: 1.51

Installation

Run this command to update or install the library:

go get -u github.com/armored-dragon/go-imgui

Usage

Usage is more or less identical to the C++ library. For example, imgui.ShowTestWindow() will show the built-in demo window, which contains usage of just about every feature imgui has to offer. All Im type prefixes are removed, so types like ImVec2 or ImFontAtlas become imgui.Vec2 and imgui.FontAtlas. ImGui type prefixes are also removed. Prefixes of flag constants are also removed, so ImGuiWindowFlags_NoResize will become imgui.WindowFlags_NoResize, and so on for other flags.

If you import the package under a different name, just use packagename. instead of imgui..

Nested Structs

Certain nested structs present in imgui, such as Glyph (ImFont::Glyph), are not available in these bindings. This is because SWIG doesn't support nested structs. Full list of such structs:

  • ImGuiTextFilter::TextRange
  • ImGuiStorage::Pair
  • ImFontAtlas::GlyphRangesBuilder
  • ImFontAtlas::CustomRect
  • ImFont::Glyph

Generating

To generate the bindings with SWIG, this command is used:

swig -go -cgo -c++ -intgosize 32 imgui.i

Full generate-and-build command (for convenience):

swig -go -cgo -c++ -intgosize 32 imgui.i && bash patch.sh && go install -x

Note: The result will not compile unless patch.sh is run. This is because SWIG fails to recognize a case of function overload ambiguity and the resulting call fails to compile.

You can’t perform that action at this time.