-
- All Implemented Interfaces:
public class GuiBaseThe base class you need to extend/inherit from to create a GUI
call the constructor of this class in your constructor (via super) and pass it a guiLayout object you can use the defaultGuiLayout by passing nothing if you want to get started quickly
Override getTitleString to set a display title
call GuiBase.addButton and/or addButtonGroup in your constructor to define what the GUI does
Call this classes advance and render in a BaseEveryFrame(Combat)Script advance/render methods
It makes sense to create a new GUI object when a hotkey is pressed
To get started quickly, you can use the SampleGuiLauncher
-
-
Field Summary
Fields Modifier and Type Field Description private final Colorcolorprivate LazyFontfontprivate final List<ActionButton>standaloneButtonsprivate final List<DataButtonGroup>buttonGroups
-
Method Summary
Modifier and Type Method Description final ColorgetColor()final LazyFontgetFont()final UnitsetFont(LazyFont font)final List<ActionButton>getStandaloneButtons()final List<DataButtonGroup>getButtonGroups()StringgetTitleString()override this returning a string representing your GUI title may change between frames StringgetMessageString()override this to display a message, feel free to return null may change between frames final UnitaddButtonGroup(ButtonGroupAction action, CreateButtonsAction create, RefreshButtonsAction refresh, String descriptionText)This is the intended way of adding button groups adds a new button group to the GUI. final UnitaddCustomButtonGroup(DataButtonGroup buttonGroup)It is recommended to use addButtonGroup instead. final UnitaddButton(ButtonAction action, String txt, String tooltipTxt, Boolean isDisabled)add a new button to the GUI and let this library handle positioning a button in this context is the simplest GUI element. final UnitaddCustomButton(ActionButton button)It is recommended to use addButton instead of this add a custom button where you have to take care of positioning etc. final ButtonGroupLayoutcreateButtonGroupLayout(Integer index)returns layout that would be assigned to button group when using addButtonGroup final ButtonInfocreateButtonInfo(Integer xIndex, String txt, String tooltipTxt)UnitrefreshButtons()calls the refresh method of every button group gets automatically called in advance, feel free to call once at the end of your constructor call Unitadvance()call this every frame in your e.g. UnitreRenderButtonGroups()delete all buttons from button groups and re-create them with the given CreateButtonsAction Unitrender()call this every frame in your e.g. -
-
Constructor Detail
-
GuiBase
GuiBase(GuiLayout guiLayout)
-
-
Method Detail
-
getFont
final LazyFont getFont()
-
getStandaloneButtons
final List<ActionButton> getStandaloneButtons()
-
getButtonGroups
final List<DataButtonGroup> getButtonGroups()
-
getTitleString
String getTitleString()
override this returning a string representing your GUI title may change between frames
-
getMessageString
String getMessageString()
override this to display a message, feel free to return null may change between frames
-
addButtonGroup
final Unit addButtonGroup(ButtonGroupAction action, CreateButtonsAction create, RefreshButtonsAction refresh, String descriptionText)
This is the intended way of adding button groups adds a new button group to the GUI. This library will take care of positioning based on grid layout. all actions will be automatically executed when appropriate
Think of a button group as a row of buttons that can be clicked. Whenever a button gets clicked by the user, it gets activated (i.e. visually highlighted). The user can click the button again to de-activate it. Each button has data (e.g. a string, maybe its name?) associated to it. Whenever a button in this group is clicked by the user, the action of the button group gets executed on the data of all active buttons.
- Parameters:
action- will be performed when one of the buttons gets clicked, can't pass null Implement a class that implements ButtonGroupAction, overriding the execute method A list of data corresponding to the data of all currently active buttons will be passed to this actioncreate- will be performed when the button group gets added, create individual buttons in this action, can't pass null Use the pre-existing class CreateSimpleButtons if you don't want to do anything fancyrefresh- will be called whenever something changes (e.g.
-
addCustomButtonGroup
final Unit addCustomButtonGroup(DataButtonGroup buttonGroup)
It is recommended to use addButtonGroup instead. add a custom button group where you have to take care of positioning etc. You will need to create a new class that inherits from DataButton group and pass an instance to this method actions will be automatically executed when appropriate
-
addButton
final Unit addButton(ButtonAction action, String txt, String tooltipTxt, Boolean isDisabled)
add a new button to the GUI and let this library handle positioning a button in this context is the simplest GUI element. If a user clicks it, the passed action gets executed
- Parameters:
action- will be executed when the button is click, feel free to pass nulltxt- display text AKA name of the buttontooltipTxt- will be displayed when user hovers over button, feel free to pass an empty string
-
addCustomButton
final Unit addCustomButton(ActionButton button)
It is recommended to use addButton instead of this add a custom button where you have to take care of positioning etc.
-
createButtonGroupLayout
final ButtonGroupLayout createButtonGroupLayout(Integer index)
returns layout that would be assigned to button group when using addButtonGroup
-
createButtonInfo
final ButtonInfo createButtonInfo(Integer xIndex, String txt, String tooltipTxt)
-
refreshButtons
Unit refreshButtons()
calls the refresh method of every button group gets automatically called in advance, feel free to call once at the end of your constructor call
-
advance
Unit advance()
call this every frame in your e.g. BaseEveryFrameCombatPlugin executes button logic, such as checking which button was clicked and executing actions when appropriate
-
reRenderButtonGroups
Unit reRenderButtonGroups()
delete all buttons from button groups and re-create them with the given CreateButtonsAction
-
-
-
-