MagicCombatGuiBase

open class MagicCombatGuiBase constructor(guiLayout: MagicCombatGuiLayout = createDefaultMagicCombatGuiLayout())

The 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 MagicCombatGuiBase.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 SampleMagicCombatGuiLauncher.

Example implementation:

public class ExampleCombatGui extends GuiBase {
// GUI setup work is done in constructor
public ExampleCombatGui(){
super(
new MagicCombatGuiLayout(0.05f, 0.8f, 100f, 20f, 0.5f,
Color.WHITE,5f, 0.4f, 0.2f, 25f,
"graphics/fonts/insignia15LTaa.fnt", 0.4f, 0.4f)
);

addButton(new MyButtonAction(), // MyButtonAction is a class you need to write that implements [ButtonAction]
"MyButton", // title of the button, i.e. text displayed on the button
"my tooltip text", // text to display when user hovers over the button
false // if the button should be disabled (usually false)
);

addButtonGroup(
new MagicCombatMyButtonGroupAction(), // A class you need to write that implements [ButtonGroupAction]
new MagicCombatCreateSimpleButtons( // you can also write your own class that implements [CreateButtonsAction]
Arrays.asList("button1", "button2"),
null,
null
),
null,
"Example button group"
);
}

@Nullable
@Override
protected String getTitleString() {
return "This is an example title";
}

@Nullable
@Override
protected String getMessageString() {
return "This is a sample message";
}
}

Author

Jannes

Since

1.3.0

Constructors

Link copied to clipboard
constructor(guiLayout: MagicCombatGuiLayout = createDefaultMagicCombatGuiLayout())

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun advance()

Call this every frame in your e.g. com.fs.starfarer.api.combat.BaseEveryFrameCombatPlugin. Executes button logic, such as checking which button was clicked and executing actions when appropriate.

Link copied to clipboard
open fun render()

Call this every frame in your e.g. com.fs.starfarer.api.combat.BaseEveryFrameCombatPlugin. Renders buttons, texts and tooltips.

Link copied to clipboard

Delete all buttons from button groups and re-create them with the given MagicCombatCreateButtonsAction.

Properties

Link copied to clipboard