/// <summary> /// Adds a static custom draw component to the GUI. /// </summary> /// <param name="bounds">The bounds of the component.</param> /// <param name="OnDraw">The event fired when the element is drawn.</param> public static GuiComposer AddStaticCustomDraw(this GuiComposer composer, ElementBounds bounds, DrawDelegateWithBounds OnDraw) { if (!composer.Composed) { composer.AddStaticElement(new GuiElementCustomDraw(composer.Api, bounds, OnDraw)); } return(composer); }
/// <summary> /// Adds a static text component to the GUI /// </summary> /// <param name="text">The text of the text component.</param> /// <param name="font">The font of the text.</param> /// <param name="orientation">The orientation of the text.</param> /// <param name="bounds">The bounds of the text container.</param> /// <param name="key">The name of the component.</param> public static GuiComposer AddStaticText(this GuiComposer composer, string text, CairoFont font, EnumTextOrientation orientation, ElementBounds bounds, string key = null) { if (!composer.composed) { composer.AddStaticElement(new GuiElementStaticText(composer.Api, text, orientation, bounds, font), key); } return(composer); }
public static GuiComposer AddImage(this GuiComposer composer, ElementBounds bounds, AssetLocation imageAsset) { if (!composer.Composed) { composer.AddStaticElement(new GuiElementImage(composer.Api, bounds, imageAsset)); } return(composer); }
// Single rectangle shape /// <summary> /// Adds a single rectangle background to the GUI. /// </summary> /// <param name="bounds">The bounds of the GUI</param> /// <param name="withTitleBar">Minor style adjustments to accomodate titlebars</param> /// <param name="topPadding">The amount of padding at the top of the gui.</param> public static GuiComposer AddShadedDialogBG(this GuiComposer composer, ElementBounds bounds, bool withTitleBar = true, double strokeWidth = 5) { if (!composer.Composed) { composer.AddStaticElement(new GuiElementDialogBackground(composer.Api, bounds, withTitleBar, strokeWidth)); } return(composer); }
/// <summary> /// Adds a gray background to the current GUI. /// </summary> /// <param name="bounds">The bounds of the backgrounds.</param> public static GuiComposer AddGrayBG(this GuiComposer composer, ElementBounds bounds) { if (!composer.composed) { composer.AddStaticElement(new GuiElementGrayBackground(composer.Api, bounds)); } return(composer); }
/// <summary> /// Adds a background to the current GUI /// </summary> /// <param name="bounds">The bounds of the background</param> /// <param name="textureLoc">The name of the background texture.</param> /// <param name="brightness">The brightness of the texture (default: 1f)</param> public static GuiComposer AddImageBG(this GuiComposer composer, ElementBounds bounds, AssetLocation textureLoc, float brightness = 1f) { if (!composer.Composed) { composer.AddStaticElement(new GuiElementImageBackground(composer.Api, bounds, textureLoc, brightness)); } return(composer); }
/// <summary> /// Adds an inset to the current GUI. /// </summary> /// <param name="bounds">The bounds of the inset.</param> /// <param name="depth">The depth of the inset.</param> /// <param name="brightness">The brightness of the inset.</param> public static GuiComposer AddInset(this GuiComposer composer, ElementBounds bounds, int depth = 4, float brightness = 0.85f) { if (!composer.Composed) { composer.AddStaticElement(new GuiElementInset(composer.Api, bounds, depth, brightness)); } return(composer); }
/// <summary> /// Adds a background to the current GUI /// </summary> /// <param name="bounds">The bounds of the background</param> /// <param name="textureName">The name of the background texture.</param> /// <param name="brightness">The brightness of the texture (default: 1f)</param> public static GuiComposer AddImageBG(this GuiComposer composer, ElementBounds bounds, string textureName, float brightness = 1f) { if (!composer.composed) { composer.AddStaticElement(new GuiElementImageBackground(composer.Api, bounds, textureName, brightness)); } return(composer); }
/// <summary> /// Adds a static text component to the GUI that automatically resizes as necessary. /// </summary> /// <param name="text">The text of the text component.</param> /// <param name="font">The font of the text.</param> /// <param name="orientation">The orientation of the text.</param> /// <param name="bounds">The bounds of the text container.</param> /// <param name="key">The name of the component.</param> public static GuiComposer AddStaticTextAutoBoxSize(this GuiComposer composer, string text, CairoFont font, EnumTextOrientation orientation, ElementBounds bounds, string key = null) { if (!composer.composed) { GuiElementStaticText elem = new GuiElementStaticText(composer.Api, text, orientation, bounds, font); composer.AddStaticElement(elem, key); elem.AutoBoxSize(); } return(composer); }
public static GuiComposer AddDialogBG(this GuiComposer composer, ElementBounds bounds, bool withTitleBar = true) { if (!composer.Composed) { GuiElementDialogBackground elem = new GuiElementDialogBackground(composer.Api, bounds, withTitleBar); elem.Shade = false; composer.AddStaticElement(elem); } return(composer); }
/// <summary> /// Adds an overlay to the current GUI. /// </summary> /// <param name="bounds">The bounds of the overlay.</param> /// <param name="backgroundColor">The background color of the overlay.</param> public static GuiComposer AddGameOverlay(this GuiComposer composer, ElementBounds bounds, double[] backgroundColor = null) { if (!composer.Composed) { if (backgroundColor == null) { backgroundColor = GuiStyle.DialogDefaultBgColor; } composer.AddStaticElement(new GuiElementGameOverlay(composer.Api, bounds, backgroundColor)); } return(composer); }