Table of Contents

ChangeLog for the recent update 18.4.2018: http://wiki.mmominion.com/doku.php?id=gui_api_changelog

GUI API Documentation

You can easily build your own ingame GUI or draw custom shapes / icons / pictures through LUA. Each rendered frame the “Gameloop.Draw” - LUA-Event is called. You need to register your LUA function for this event and then you can build your GUI in there.

Simple demo code firstaddon.zip you can download and extract into your addon folder: MINIONAPP\Bots\xxxx\LuaMods\

Example: To get you started, let's draw a simple window with a slider, create a new .lua file, add it to your addon's module.def and put the following code into that new lua file:

-- Draws a Window with a Slider:
my_gui = {}
my_gui.open = true
my_gui.visible = true
my_gui.hue = 125
 
function my_gui.Draw( event, ticks ) 	
 
	if ( my_gui.open ) then 
 
           GUI:SetNextWindowSize(250,400,GUI.SetCond_FirstUseEver) -- set the next window size, only on first ever, GUI.SetCond_FirstUseEver is one of many possible enums.
 
           --GUI:Begin takes in two arguments, the name of the window and the current "is open" bool. It returns "is visible/is not collapsed" and the "is open" bool again.
           --If the user would close our Window, "is open" would return "false", else it will keep returning "true" as long as the window is open.
	   my_gui.visible, my_gui.open = GUI:Begin("My Fancy GUI", my_gui.open)
 
           if ( my_gui.visible ) then -- visible is true/false depending if the window is collapsed or not, we don't have to render anything in it when it is collapsed
                -- Again the typical syntax, passing the current value "hue" to the function as argument and receiving back the (un-)changed value. 
	   	my_gui.hue = GUI:SliderInt("Master HUE",my_gui.hue,0,255)
	        d(my_gui.hue)  -- spam print out the current value
	   end
	   GUI:End()  -- THIS IS IMPORTANT! For EVERY BEGIN() you NEED to ALWAYS call END(), it does not matter if the window is visible/open or not! Same goes with BeginChild() & EndChild() and others !
        end	
end
RegisterEventHandler("Gameloop.Draw", my_gui.Draw, "My_GUI-AnyNameHereToIdentYourCode")


Important Information

Example: Same name in UI, different internal identifier:
GUI:Button("Banana")
GUI:Button("Banana##1")
Example: Different name in UI, same internal identifier: 
GUI:Button("Banana###123hohoho") 
GUI:Button("Pineapple###123hohoho")
Example: Different name in UI, same internal identifier with auto **Translations**: 
GUI:Button(GetString("Banana").."###123hohoho") 
GUI:Button(GetString("Pineapple").."###123hohoho")

Window Functions

Style

Layout

Cursor

ID Scopes

If you are creating multiple GUI Elements you want to push a unique identifier so ImGui can differentiate them. You can also use “##extra” within your widget name to distinguish them from each others.

Widgets Main

Widgets Drags

(Tip: ctrl+click on a drag box to input text)

Widgets Input

Widgets Sliders

Color Editor/Picker

Widgets Trees

Widgets Lists

Widgets Tooltip

Widgets Menus

Widgets Popup

Widgets Utilities

Custom Widgets

Custom Drawing

Usage: GUI:AddCircleFilled( 300, 300, 475,GUI:ColorConvertFloat4ToU32(0.9,0.1,0.12,0.5)) IMPORTANT: Use GUI:ColorConvertFloat4ToU32() to calculatethe required numbercolor argument!!

Enums & Flags

These are registered values in the GUI metatable. Usage: d(GUI.WindowFlags_NoMove) will print “2” into the console.

WindowFlags
InputTextFlags
SelectableFlags
ComboFlags
PushStyleColor
PushStyleVar
ColorEditMode
SetCondFlags
DrawCornerFlags
FocusedFlags
HoveredFlags
Directions
TreeNodeFlags