Table of Contents

Interface IGuiAPI

Namespace
Vintagestory.API.Client
Assembly
VintagestoryAPI.dll
public interface IGuiAPI

Properties

Icons

A utility class that contains a bunch of hardcoded icons

IconUtil Icons { get; }

Property Value

IconUtil

LoadedGuis

List of all registered guis

List<GuiDialog> LoadedGuis { get; }

Property Value

List<GuiDialog>

OpenedGuis

List of all currently opened guis

List<GuiDialog> OpenedGuis { get; }

Property Value

List<GuiDialog>

QuadMeshRef

Just a default gpu-uploaded quad for 2d texture rendering, for your convenience

MeshRef QuadMeshRef { get; }

Property Value

MeshRef

Text

A utlity class that helps draw text

TextDrawUtil Text { get; }

Property Value

TextDrawUtil

TextTexture

A utility class that does text texture generation for you

TextTextureUtil TextTexture { get; }

Property Value

TextTextureUtil

WindowBounds

Returns a ElementBounds that is always the size of the game window

ElementBounds WindowBounds { get; }

Property Value

ElementBounds

Methods

CreateCompo(string, ElementBounds)

Creates a new gui composition

GuiComposer CreateCompo(string dialogName, ElementBounds bounds)

Parameters

dialogName string
bounds ElementBounds

Returns

GuiComposer

DeleteTexture(int)

Removes given texture from graphics card memory

void DeleteTexture(int textureid)

Parameters

textureid int

DrawSvg(IAsset, ImageSurface, Matrix, int, int, int, int, int?)

void DrawSvg(IAsset svgAsset, ImageSurface intoSurface, Matrix transform, int posx, int posy, int width = 0, int height = 0, int? color = 0)

Parameters

svgAsset IAsset
intoSurface ImageSurface
transform Matrix
posx int
posy int
width int
height int
color int?

DrawSvg(IAsset, ImageSurface, int, int, int, int, int?)

void DrawSvg(IAsset svgAsset, ImageSurface intoSurface, int posx, int posy, int width = 0, int height = 0, int? color = 0)

Parameters

svgAsset IAsset
intoSurface ImageSurface
posx int
posy int
width int
height int
color int?

GetDialogBoundsInArea(EnumDialogArea)

If there is a currenly opened dialog or hud element, the method will return the bounds occuppying that area, otherwise null

List<ElementBounds> GetDialogBoundsInArea(EnumDialogArea area)

Parameters

area EnumDialogArea

Returns

List<ElementBounds>

GetDialogPosition(string)

Retrieve the saved dialog position from settings

Vec2i GetDialogPosition(string key)

Parameters

key string

Returns

Vec2i

LoadCairoTexture(ImageSurface, bool)

Load the contents of a cairo surface into a opengl texture. Returns the texture id

int LoadCairoTexture(ImageSurface surface, bool linearMag)

Parameters

surface ImageSurface
linearMag bool

Returns

int

LoadOrUpdateCairoTexture(ImageSurface, bool, ref LoadedTexture)

Load the contents of a cairo surface into a opengl texture. Re-uses the supplied texture exists and the size is correct. Otherwise deletes the texture and regenerates it.

void LoadOrUpdateCairoTexture(ImageSurface surface, bool linearMag, ref LoadedTexture intoTexture)

Parameters

surface ImageSurface
linearMag bool
intoTexture LoadedTexture

LoadSvg(AssetLocation, int, int, int, int, int?)

Loads an external .svg file into a texture. Will return null if the file is not found

LoadedTexture LoadSvg(AssetLocation loc, int textureWidth, int textureHeight, int width = 0, int height = 0, int? color = 0)

Parameters

loc AssetLocation
textureWidth int
textureHeight int
width int
height int
color int?

Returns

LoadedTexture

LoadSvgWithPadding(AssetLocation, int, int, int, int?)

Loads an external .svg file into a texture. Will return null if the file is not found

LoadedTexture LoadSvgWithPadding(AssetLocation loc, int textureWidth, int textureHeight, int padding = 0, int? color = 0)

Parameters

loc AssetLocation
textureWidth int
textureHeight int
padding int
color int?

Returns

LoadedTexture

Opens up a confirm dialog asking the player if he wants to open an external link

void OpenLink(string href)

Parameters

href string

PlaySound(string, bool, float)

Plays a sound, non location specific

void PlaySound(string soundname, bool randomizePitch = false, float volume = 1)

Parameters

soundname string

The name of the sound

randomizePitch bool

If true, the pitch is slightly randomized each time

volume float

PlaySound(AssetLocation, bool, float)

Plays a sound, non location specific.

void PlaySound(AssetLocation soundname, bool randomizePitch = false, float volume = 1)

Parameters

soundname AssetLocation

The name of the sound

randomizePitch bool

If true, the pitch is slightly randomized each time

volume float

RegisterDialog(params GuiDialog[])

Register given dialog(s) to the gui/input event listening chain. You only need to call this if your dialog has to listen to events even while closed. The method GuiDialog.TryOpen() also does the register if not registered already.

void RegisterDialog(params GuiDialog[] dialogs)

Parameters

dialogs GuiDialog[]

RequestFocus(GuiDialog)

Requests the given GUI to be given focus.

void RequestFocus(GuiDialog guiDialog)

Parameters

guiDialog GuiDialog

The dialogue wanting attention.

SetDialogPosition(string, Vec2i)

Remember the dialog position for given dialog key

void SetDialogPosition(string key, Vec2i pos)

Parameters

key string
pos Vec2i

TriggerDialogClosed(GuiDialog)

Triggers the closing of a dialogue.

void TriggerDialogClosed(GuiDialog guiDialog)

Parameters

guiDialog GuiDialog

The dialogue to be closed.

TriggerDialogOpened(GuiDialog)

Triggers the opening of a dialogue.

void TriggerDialogOpened(GuiDialog guiDialog)

Parameters

guiDialog GuiDialog

The dialogue to be opened.