Skip to content

API reference Obsidian.API.Client.Screens

Widget class

A piece of a mod's screen, like a label, a button or a grid of slots: the mod adds it to its screen (see WidgetGroup.Add) and changes its properties whenever it likes, and the client draws it as they are each frame, with its own widgets, like vanilla's.

public abstract class Widget

In Obsidian.API.Client.

Remarks

Positions and sizes are in the GUI's pixels, from the top left of the screen's panel (see ModScreen.Width). Widgets are used on the game's thread, where the screen's methods and the widgets' events run.

Constructors

protected Widget();

Properties

Height

public int Height { get; set; }

The widget's height, in pixels; widgets that size themselves (labels, grids) say so.

Tooltip

public string Tooltip { get; set; }

Text shown in a tooltip while the mouse is over the widget, one line per \n, with vanilla's legacy § formatting codes; null for none.

Visible

public bool Visible { get; set; }

Whether the widget is drawn and takes input.

Width

public int Width { get; set; }

The widget's width, in pixels; widgets that size themselves (labels, grids) say so.

X

public int X { get; set; }

Pixels from the panel's left edge.

Y

public int Y { get; set; }

Pixels from the panel's top edge.

On this page