Skip to content

JetSetIlly/imgui-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dear ImGui for Go

This library is a Go wrapper for Dear ImGui

This specific instance of the library is a continuation of the library started by Christian Haas, who ceased development some time ago. Despite the original project not being updated in quite some time, I still find it a good solution for my projects. As such, I have decided to update the project so that it uses more recent versions of the base Dear Imgui project.

The current version of Dear Imgui being used is the docking branch of v1.91.9b

Not all features of v1.91.9b are available but in principle they can be added using the existing methods.

Docking can be enabled but viewports are currently unimplemented.

Changes from version 4 of imgui-go

If you're moving from a previous version of imgui-go you should be aware that some things have changed, due to changes in Dear Imgui itself.

Keyboard

KeyPress() and KeyRelease() have been removed and replaced with AddKeyEvent().

See the SDL and GLFW platform examples in the updated imgui-go-examples repository for how to use the new function.

Cursor Positioning

SetCursorPos() and SetScreenCursorPos() requires a call to Dummy() if the position change causes the parent area to be extended. Dear Imgui will panic if it can't validate the new extent.

Content Regions

ContentRegionMax() has been removed. ContentRegionAvail() is a good substitute in many cases, but remember to take the current cursor position into account.

Disabling Widgets

ItemFlagsDisabled has been removed. Use BeginDisabled() and EndDisabled() instead.

ChildFlags

BeginChildV() now takes flags of the type ChildFlags and not WindowFlags.

Some WindowFlags have no ChildFlags equivalent: NoMove, AlwaysAutoResize, NoScrollbar and AlwaysVerticalScrollbar.

All missing functionality can be achieved in other ways. For example, NoMove can be replicated by detecting the hover status of the Child:

	imgui.BeginChild()
	...
	imgui.EndChild()
	
	state.hover := imgui.IsHovered()

And then next frame, changing the window flags for the containing window:

	var flgs imgui.Flags
	if state.hover {
		flags = imgui.WindowFlagsNoMove
	} else  {
		flags = imgui.WindowFlagsNone
	}

ListClipper

ListClipperAll() replaces all other functions of the ListClipper type Begin(), Step() and End(). The ListClipper type is now returned by the new function and contains only the final results.

	results := imgui.ListClipperAll(len(entries), func(i int) {
		imgui.Text(entries[i])
	})

This new function was added because I was having problems maintaining state when returning from the three canonical functions. Calling Go as a callback from C solves the problem and makes for a convenient function. The downside is that you can't change the ListClipper state between the Step() and DisplayStart-to-DisplayEnd loop - but having tried doing that kind of thing in the past, being prevented from doing it is probably a feature.

About

Go wrapper library for "Dear ImGui" (https://github.com/ocornut/imgui)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 80.8%
  • C 11.3%
  • Go 4.6%
  • Objective-C++ 2.2%
  • Makefile 0.4%
  • Objective-C 0.3%
  • Other 0.4%