ChangeLog for the recent update 18.4.2018: http://wiki.mmominion.com/doku.php?id=gui_api_changelog
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")
ml_gui.showtestwindow = true
GUI:Begin(string name, bool open, windowflags flags)
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")
GUI:ShowTestWindow(bool isopen)
GUI:ShowMetricsWindow(bool isopen)
GUI:Begin(string name, bool open, windowflags flags)
GUI:End()
GUI:BeginChild(string name, int sizeX, int sizeY, bool border, windowflags flags
GUI:EndChild()
GUI:IsWindowAppearing()
GUI:IsWindowCollapsed()
GUI:IsWindowFocused(FocusedFlags flags)
GUI:IsWindowHovered(HoveredFlags flags)
GUI:GetWindowPos()
GUI:GetWindowSize()
GUI:GetWindowWidth()
GUI:GetWindowHeight()
GUI:GetContentRegionMax()
GUI:GetContentRegionAvail()
GUI:GetContentRegionAvailWidth()
GUI:GetWindowContentRegionMin()
GUI:GetWindowContentRegionMax()
GUI:GetWindowContentRegionWidth()
GUI:SetNextWindowPos( number X, number Y, SetCondflags flags, number pivotX, number pivotY)
GUI:SetNextWindowSize( number X, number Y, SetCondflags flags)
GUI:SetNextWindowContentSize( number X, number Y)
GUI:SetNextWindowCollapsed( bool collapsed, SetCondflags flags)
GUI:SetNextWindowFocus()
GUI:SetWindowPos( number X, number Y, SetCondflags flags)
GUI:SetWindowPos( string name, number X, number Y, SetCondflags flags)
GUI:SetWindowSize( number X, number Y, SetCondflags flags)
GUI:SetWindowSize( string name, number X, number Y, SetCondflags flags)
GUI:SetWindowCollapsed( bool collapsed, SetCondflags flags)
GUI:SetWindowCollapsed( string name, bool collapsed, SetCondflags flags)
GUI:SetWindowFocus( string name)
GUI:GetScrollX()
GUI:GetScrollY()
GUI:GetScrollMaxX()
GUI:GetScrollMaxY()
GUI:SetScrollX( number scrollX)
GUI:SetScrollY( number scrollX)
GUI:SetScrollHere( number center_y_ratio)
GUI:SetScrollFromPosY( number pos_y, number center_y_ratio)
GUI:SetKeyboardFocusHere(number offset)
GUI:PushStyleColor(PushStyleColor flags, number R, number G, number B, number A)
GUI:PopStyleColor( number count )
GUI:PushStyleVar(PushStyleVar flags, number val, number val2)
GUI:PopStyleVar( number count )
GUI:GetColorU32( number r, number g, number b, number a )
GUI:PushItemWidth( number item_width )
GUI:PopItemWidth( )
GUI:CalcItemWidth( )
GUI:PushTextWrapPos( number wrap_pos_x )
GUI:PopTextWrapPos( )
GUI:PushAllowKeyboardFocus( bool val )
GUI:PopAllowKeyboardFocus( )
GUI:PushButtonRepeat( bool repeat)
GUI:PopButtonRepeat( )
GUI:GetWindowFontSize()
GUI:SetWindowFontSize( number scale)
GUI:GetGlobalFontSize()
GUI:SetGlobalFontSize( number scale)
GUI:AlignFirstTextHeightToWidgets( )
GUI:Separator( )
GUI:SameLine( number local_pos_x, number spacing_w )
GUI:NewLine()
GUI:Spacing( )
GUI:Dummy( number sizeX, number sizeY )
GUI:Indent( )
GUI:Unindent( )
GUI:BeginGroup( )
GUI:EndGroup( )
GUI:Columns( number count, string name, bool border )
GUI:NextColumn( )
GUI:GetColumnIndex( )
GUI:GetColumnOffset( number column_index )
GUI:SetColumnOffset( number column_index, number offset_x )
GUI:GetColumnWidth( number column_index )
GUI:SetColumnWidth( number column_index, number width )
GUI:GetColumnsCount( )
GUI:GetTextLineHeight( )
GUI:GetTextLineHeightWithSpacing( )
GUI:GetFrameHeight( )
GUI:GetFrameHeightWithSpacing( )
GUI:BeginTable()
GUI:EndTable()
GUI:TableNextRow()
GUI:TableNextColumn()
GUI:TableSetColumnIndex(number column_index)
GUI:TableGetColumnIndex()
GUI:TableGetRowIndex()
GUI:TableGetColumnCount()
GUI:TableGetColumnFlags(number column_index)
GUI:TableSetBgColor(number color)
GUI:TableSetColumnWidth(number column_index, number width)
GUI:TableSetColumnSortDirection(number column_index, boolean ascending)
GUI:TableSetupColumn(string label, number flags, number init_width_or_weight)
GUI:TableHeadersRow()
GUI:TableHeader(string label)
GUI:TableSetupScrollFreeze(number cols, number rows)
GUI:TableGetColumnName(number column_index)
GUI:TableSetColumnEnabled(number column_index, boolean enabled)
GUI:BeginTabBar()
GUI:EndTabBar()
GUI:BeginTabItem(string label)
GUI:EndTabItem()
GUI:TabItemButton(string label)
GUI:SetTabItemClosed(string label)
GUI:GetCursorPos( )
GUI:GetCursorPosX( )
GUI:GetCursorPosY( )
GUI:SetCursorPos( number x, number y )
GUI:SetCursorPosX( number x )
GUI:SetCursorPosY( number y )
GUI:GetCursorStartPos( )
GUI:GetCursorScreenPos( )
GUI:SetCursorScreenPos( number x, number y )
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.
GUI:PushID( string id)
GUI:PopID( )
GUI:GetID( string id)
GUI:Text( string text)
GUI:TextColored( number R, number G, number B, number A, string text)
GUI:TextDisabled( string text)
GUI:TextWrapped( string text)
GUI:TextUnformatted( string text)
GUI:LabelText( string label, string text)
GUI:Bullet( )
GUI:BulletText( string text)
GUI:Button( string label, number sizeX, number sizeY)
GUI:SmallButton( string label)
GUI:ArrowButton( string label, Direction direction )
GUI:InvisibleButton( string label, number sizeX, number sizeY)
GUI:ColorButton( string id, number R, number G, number B, number A, ColorEditMode flags, number sizeX, number sizeY)
GUI:FreeButton( string label, number posX, number posY, number sizeX, number sizeY)
GUI:FreeImageButton( /string internalid, string filepath, number posX, number posY, number sizeX, number sizeY)
GUI:ImageButton(string internalid, string filepath, number sizeX, number sizeY, number UV0_x, number UV0_y, number UV1_x, number UV1_y, number framepadding,number bg_col_R, number bg_col_G, number bg_col_B, number bg_col_A, number tint_col_R, number tint_col_G, number tint_col_B, number tint_col_A )
GUI:Image(string filepath, number sizeX, number sizeY, number UV0_x, number UV0_y, number UV1_x, number UV1_y, number bg_col_R, number bg_col_G, number bg_col_B, number bg_col_A, number tint_col_R, number tint_col_G, number tint_col_B, number tint_col_A )
GUI:Checkbox( string label, bool checked)
GUI:CheckboxFlags( string label, number flags, number flags_value)
GUI:RadioButton( string label, bool active)
GUI:RadioButton( string label, bool active, number val)
GUI:BeginCombo( string label, string preview_value, ComboFlag)
GUI:EndCombo()
GUI:Combo( string label, number current_item_listindex, table itemlist, number height_in_items)
GUI:ProgressBar( number fraction, number SizeX, number SizeY, string overlay )
(Tip: ctrl+click on a drag box to input text)
GUI:DragFloat( string label, number val, number v_speed, number v_min, number v_max, string display_format, number power)
GUI:DragFloatRange2( string label, number v_current_min, number v_current_max, number v_speed, number v_min, number v_max, string display_format, string display_format_max, number power)
GUI:DragInt( string label, number val, number v_speed, number v_min, number v_max, string display_format)
GUI:DragIntRange2( string label, number v_current_min, number v_current_max, number v_speed, number v_min, number v_max, string display_format, string display_format_max)
GUI:InputText( string label, string text, InputTextFlags flags)
GUI:InputTextMultiline( string label, string text, number sizeX, number sizeY , InputTextFlags flags)
GUI:InputTextEditor( string label, string text, number sizeX, number sizeY , InputTextFlags flags)
GUI:InputFloat( string label, number val, number step, number step_fast, number decimal_precision, InputTextFlags flags)
GUI:InputFloat2( string label, number val, number val2, number decimal_precision, InputTextFlags flags)
GUI:InputFloat3( string label, number val, number val2, number val3, number decimal_precision, InputTextFlags flags)
GUI:InputFloat4( string label, number val, number val2, number val3, number val4, number decimal_precision, InputTextFlags flags)
GUI:InputInt( string label, number val, number step, number step_fast, InputTextFlags flags)
GUI:InputInt2( string label, number val, number val2, InputTextFlags flags)
GUI:InputInt3( string label, number val, number val2, number val3, InputTextFlags flags)
GUI:InputInt4( string label, number val, number val2, number val3, number val4, InputTextFlags flags)
GUI:SliderFloat( string label, number val, number v_min, number v_max, string display_format, number power)
GUI:SliderFloat2( string label, number val, number val2, number v_min, number v_max, string display_format, number power)
GUI:SliderFloat3( string label, number val, number val2, number val3, number v_min, number v_max, string display_format, number power)
GUI:SliderFloat4( string label, number val, number val2, number val3, number val4, number v_min, number v_max, string display_format, number power)
GUI:SliderAngle( string label, number v_rad, number v_degrees_min, number v_degrees_max)
GUI:SliderInt( string label, number val, number v_min, number v_max, string display_format)
GUI:SliderInt2( string label, number val, number val2, number v_min, number v_max, string display_format)
GUI:SliderInt3( string label, number val, number val2, number val3, number v_min, number v_max, string display_format)
GUI:SliderInt4( string label, number val, number val2, number val3, number val4, number v_min, number v_max, string display_format)
GUI:VSliderFloat( string label, number sizeX, number sizeY, number val, number v_min, number v_max, string display_format, number power)
GUI:VSliderInt( string label, number sizeX, number sizeY, number val, number v_min, number v_max, string display_format)
GUI:ColorEdit3( string label, number R, number G, number B, ColorEditMode flags)
GUI:ColorEdit4( string label, number R, number G, number B, number A, ColorEditMode flags)
GUI:ColorPicker3( string label, number R, number G, number B, ColorEditMode flags)
GUI:ColorPicker4( string label, number R, number G, number B, number A, ColorEditMode flags)
GUI:ColorEditMode( ColorEditMode mode)
GUI:TreeNode( string label)
GUI:TreeNode( string label, string args)
GUI:TreeNode( string label, TreeNodeFlag flags, string args)
GUI:TreePush( string id)
GUI:TreePop( )
GUI:SetNextTreeNodeOpened( bool opened, SetCond flags)
GUI:CollapsingHeader( string label, TreeNodeFlag flags)
GUI:CollapsingHeader( string label, bool p_open, TreeNodeFlag flag)
GUI:Selectable( string label, bool selected, SelectableFlag flags, number sizeX, number sizeY )
GUI:ListBox( string label, number current_listitem_index, table itemlist, number height_in_items )
GUI:ListBoxHeader( string label, number items_count, number height_in_items )
GUI:ListBoxFooter( )
GUI:SetTooltip( string label )
GUI:BeginTooltip( )
GUI:EndTooltip( )
GUI:BeginMainMenuBar( )
GUI:EndMainMenuBar( )
GUI:BeginMenuBar( )
GUI:EndMenuBar( )
GUI:BeginMenu( string label, bool enabled )
GUI:EndMenu( )
GUI:MenuItem( string label, string shortcut, bool selected, bool enabled)
GUI:OpenPopup( string id)
GUI:BeginPopup( string id, WindowFlags flags)
GUI:BeginPopupModal( string name, bool opened, WindowFlags flags)
GUI:BeginPopupContextItem( string id, number mouse_button)
GUI:BeginPopupContextWindow( string id, number mouse_button, bool also_over_items)
GUI:BeginPopupContextVoid( string id, number mouse_button)
GUI:EndPopup( )
GUI:IsPopupOpen( string id)
GUI:CloseCurrentPopup( )
GUI:IsItemHovered( HoveredFlags flags )
GUI:IsItemActive( )
GUI:IsItemFocused( )
GUI:IsItemClicked( int mousebutton == 0)
GUI:IsItemVisible( )
GUI:IsAnyItemHovered( )
GUI:IsAnyItemActive( )
GUI:IsAnyItemFocused( )
GUI:GetItemRectMin( )
GUI:GetItemRectMax( )
GUI:GetItemRectSize( )
GUI:SetItemAllowOverlap( )
GUI:IsRectVisible( number x, number y)
GUI:GetTime( )
GUI:GetFrameCount( )
GUI:CalcTextSize( string text)
GUI:CalcListClipping( number items_count, number items_height, number out_items_display_start, number out_items_display_end)
GUI:BeginChildFrame( number guiID, number sizex, number sizey, WindowFlags flags)
GUI:EndChildFrame( )
GUI:ColorConvertU32ToFloat4( number U32val)
GUI:ColorConvertFloat4ToU32( number val1,number val2,number val3,number val4 )
GUI:ColorConvertRGBtoHSV( number r, number g, number b)
GUI:ColorConvertHSVtoRGB( number h, number s, number v)
GUI:GetScreenSize()
GUI:IsKeyDown( number virtualkey)
GUI:IsKeyPressed( number virtualkey, bool repeat)
GUI:IsKeyReleased( number virtualkey)
GUI:IsMouseDown( number button)
GUI:IsMouseClicked( number button, bool repeat)
GUI:IsMouseDoubleClicked( number button)
GUI:IsMouseReleased( number button)
GUI:IsMouseHoveringWindow( number button)
GUI:IsMouseHoveringAnyWindow( number button)
GUI:IsMouseHoveringAnyWindow( number pos_minX, number pos_minY, number pos_maxX, number pos_maxY, bool clip)
GUI:IsMouseDragging( number button, number lock_threshold)
GUI:GetMousePos( )
GUI:GetMousePosOnOpeningCurrentPopup( )
GUI:GetMouseDragDelta( number button, number lock_threshold)
GUI:ResetMouseDragDelta( number button)
GUI:GetMouseScroll( number button)
GUI:GetClipboardText()
GUI:SetClipboardText( string input)
GUI:IsItemEdited()
GUI:IsItemActivated()
GUI:IsItemDeactivated()
GUI:IsItemDeactivatedAfterEdit()
GUI:IsItemToggledOpen()
GUI:GetItemID()
GUI:GetMouseClickedCount(number button)
GUI:IsMousePosValid()
GUI:IsAnyMouseDown()
GUI:Keybind( string label, number virtualKey, number width)
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!!
GUI:AddLine( number X1, number Y1, number X2, number Y2, number color, number thickness = 1.0,)
GUI:AddRect( number X1, number Y1, number X2, number Y2, number color, number rounding= 0.0, number rounding_corners = 0.0)
GUI:AddRectFilled( number X1, number Y1, number X2, number Y2, number color, number rounding= 0.0, number rounding_corners = 0.0)
GUI:AddQuadFilled( number X1, number Y1, number X2, number Y2, number X3, number Y3, number X4, number Y4, number color)
GUI:AddTriangleFilled( number X1, number Y1, number X2, number Y2, number X3, number Y3, number color)
GUI:AddCircle( number X1, number Y1, number radius, number color, number num_segments= 12)
GUI:AddCircleFilled( number X1, number Y1, number radius, number color, number num_segments= 12)
GUI:AddText( number X1, number Y1, number color, string text)
GUI:AddImage( string texturepath, number X1, number Y1, number X2, number Y2)
RenderManager:WorldToScreen(table worldpos, bool true)
RenderManager:WorldToScreen(table worldpos)
These are registered values in the GUI metatable. Usage: d(GUI.WindowFlags_NoMove) will print “2” into the console.