Interface IGuiAPI
- Namespace
- Vintagestory.API.Client
- Assembly
- VintagestoryAPI.dll
public interface IGuiAPI
- Extension Methods
Properties
Icons
A utility class that contains a bunch of hardcoded icons
IconUtil Icons { get; }
Property Value
LoadedGuis
List of all registered guis
List<GuiDialog> LoadedGuis { get; }
Property Value
OpenedGuis
List of all currently opened guis
List<GuiDialog> OpenedGuis { get; }
Property Value
QuadMeshRef
Just a default gpu-uploaded quad for 2d texture rendering, for your convenience
MeshRef QuadMeshRef { get; }
Property Value
Text
A utlity class that helps draw text
TextDrawUtil Text { get; }
Property Value
TextTexture
A utility class that does text texture generation for you
TextTextureUtil TextTexture { get; }
Property Value
WindowBounds
Returns a ElementBounds that is always the size of the game window
ElementBounds WindowBounds { get; }
Property Value
Methods
CreateCompo(string, ElementBounds)
Creates a new gui composition
GuiComposer CreateCompo(string dialogName, ElementBounds bounds)
Parameters
dialogName
stringbounds
ElementBounds
Returns
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
IAssetintoSurface
ImageSurfacetransform
Matrixposx
intposy
intwidth
intheight
intcolor
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
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
GetDialogPosition(string)
Retrieve the saved dialog position from settings
Vec2i GetDialogPosition(string key)
Parameters
key
string
Returns
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
ImageSurfacelinearMag
bool
Returns
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
ImageSurfacelinearMag
boolintoTexture
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
Returns
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
AssetLocationtextureWidth
inttextureHeight
intpadding
intcolor
int?
Returns
OpenLink(string)
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
stringThe name of the sound
randomizePitch
boolIf 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
AssetLocationThe name of the sound
randomizePitch
boolIf 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
GuiDialogThe dialogue wanting attention.
SetDialogPosition(string, Vec2i)
Remember the dialog position for given dialog key
void SetDialogPosition(string key, Vec2i pos)
Parameters
TriggerDialogClosed(GuiDialog)
Triggers the closing of a dialogue.
void TriggerDialogClosed(GuiDialog guiDialog)
Parameters
guiDialog
GuiDialogThe dialogue to be closed.
TriggerDialogOpened(GuiDialog)
Triggers the opening of a dialogue.
void TriggerDialogOpened(GuiDialog guiDialog)
Parameters
guiDialog
GuiDialogThe dialogue to be opened.