/// <summary> /// Adds a chat input element to the UI. /// </summary> /// <param name="capi">The client API</param> /// <param name="bounds">The bounds of the chat input.</param> /// <param name="OnTextChanged">The event fired when the text is altered.</param> public GuiElementChatInput(ICoreClientAPI capi, ElementBounds bounds, API.Common.Action <string> OnTextChanged) : base(capi, null, bounds) { highlightTexture = new LoadedTexture(capi); this.OnTextChanged = OnTextChanged; this.caretColor = new float[] { 1, 1, 1, 1 }; this.Font = CairoFont.WhiteSmallText(); }
/// <summary> /// Creates a new title bar. /// </summary> /// <param name="capi">The Client API.</param> /// <param name="text">The text on the title bar.</param> /// <param name="composer">The GuiComposer for the title bar.</param> /// <param name="OnClose">The event fired when the title bar is closed.</param> /// <param name="font">The font of the title bar.</param> /// <param name="bounds">The bounds of the title bar.</param> public GuiElementDialogTitleBar(ICoreClientAPI capi, string text, GuiComposer composer, Action OnClose = null, CairoFont font = null, ElementBounds bounds = null) : base(capi, text, font, bounds) { closeIconHoverTexture = new LoadedTexture(capi); menuIconHoverTexture = new LoadedTexture(capi); if (bounds == null) { this.Bounds = ElementStdBounds.TitleBar(); } if (font == null) { this.Font = CairoFont.WhiteSmallText(); } this.OnClose = OnClose; ElementBounds dropDownBounds = ElementBounds.Fixed(0, 0, 100, 25); this.Bounds.WithChild(dropDownBounds); listMenu = new GuiElementListMenu(capi, new string[] { "auto", "manual" }, new string[] { Lang.Get("Fixed"), Lang.Get("Movable") }, 0, onSelectionChanged, dropDownBounds, CairoFont.WhiteSmallText(), false) { HoveredIndex = 0 }; baseComposer = composer; }
public void Recompose(ICoreClientAPI capi) { Texture?.Dispose(); Texture = new TextTextureUtil(capi).GenTextTexture(Stack.GetName(), CairoFont.WhiteSmallText()); scissorBounds = ElementBounds.FixedSize(50, 50); scissorBounds.ParentBounds = capi.Gui.WindowBounds; }
public GuiElementSwitchOld(ICoreClientAPI capi, API.Common.Action <bool> OnToggled, ElementBounds bounds) : base(capi, "", null, bounds) { Font = CairoFont.WhiteSmallText().WithFontSize((float)GuiStyle.SubNormalFontSize); handler = OnToggled; bounds.fixedWidth = unscaledWidth; bounds.fixedHeight = unscaledHeight; }
public void Init(ICoreClientAPI capi) { if (Text.Length < 255) { Text = Lang.Get(Text); } comps = VtmlUtil.Richtextify(capi, Text, CairoFont.WhiteSmallText().WithLineHeightMultiplier(1.2)); titleCached = Lang.Get(Title); }
/// <summary> /// Constructor for the button /// </summary> /// <param name="capi">The core client API.</param> /// <param name="color"></param> /// <param name="OnToggled">The action that happens when the button is toggled.</param> /// <param name="bounds">The bounding box of the button.</param> public GuiElementColorListPicker(ICoreClientAPI capi, int color, Action <bool> OnToggled, ElementBounds bounds) : base(capi, bounds) { activeTexture = new LoadedTexture(capi); this.color = color; handler = OnToggled; hoverText = new GuiElementHoverText(capi, "", CairoFont.WhiteSmallText(), 200, Bounds.CopyOnlySize()); hoverText.Bounds.ParentBounds = bounds; hoverText.SetAutoWidth(true); bounds.ChildBounds.Add(hoverText.Bounds); }
/// <summary> /// Adds a mod cell to the table. /// </summary> /// <param name="capi">The client API</param> /// <param name="cell">The table cell to add.</param> /// <param name="assetManager">The asset manager for the mod</param> /// <param name="bounds">The bounds of the cell</param> public GuiElementModCell(ICoreClientAPI capi, ListCellEntry cell, IAssetManager assetManager, ElementBounds bounds) : base(capi, "", null, bounds) { this.cell = cell; this.assetManager = assetManager; if (cell.TitleFont == null) { cell.TitleFont = CairoFont.WhiteSmallishText(); } if (cell.DetailTextFont == null) { cell.DetailTextFont = CairoFont.WhiteSmallText(); cell.DetailTextFont.Color[3] *= 0.6; } modcellTexture = new LoadedTexture(capi); }
/// <summary> /// Creates a new Element Cell. A container for TableCells. /// </summary> /// <param name="capi">The Client API</param> /// <param name="cell">The base cell</param> /// <param name="bounds">The bounds of the TableCell</param> public GuiElementCell(ICoreClientAPI capi, ListCellEntry cell, ElementBounds bounds) : base(capi, "", null, bounds) { this.cellEntry = cell; leftHighlightTexture = new LoadedTexture(capi); rightHighlightTexture = new LoadedTexture(capi); releasedButtonTexture = new LoadedTexture(capi); pressedButtonTexture = new LoadedTexture(capi); if (cell.TitleFont == null) { cell.TitleFont = CairoFont.WhiteSmallishText(); } if (cell.DetailTextFont == null) { cell.DetailTextFont = CairoFont.WhiteSmallText(); cell.DetailTextFont.Color[3] *= 0.8; cell.DetailTextFont.LineHeightMultiplier = 1.1; } }
public override void ComposeElements(Context ctx, ImageSurface surface) { Bounds.CalcWorldBounds(); if (drawBackground) { ctx.SetSourceRGBA(1, 1, 1, 0.6); ElementRoundRectangle(ctx, Bounds); ctx.Fill(); EmbossRoundRectangleElement(ctx, Bounds, true); } double absSlotSize = scaled(unscaledSlotSize); ElementBounds textBounds = ElementBounds .Fixed(0, unscaledSlotSize - GuiStyle.SmallFontSize - 2, unscaledSlotSize - 5, unscaledSlotSize - 5) .WithEmptyParent(); CairoFont font = CairoFont.WhiteSmallText(); font.FontWeight = FontWeight.Bold; textComposer = new GuiElementStaticText(api, "", EnumTextOrientation.Right, textBounds, font); }
public override void RenderTo(ICoreClientAPI capi, double x, double y) { float size = (float)GuiElement.scaled(25); float pad = (float)GuiElement.scaled(10); int index = (int)((capi.ElapsedMilliseconds / 1000) % Stacks.Count); dummySlot.Itemstack = Stacks[index]; capi.Render.RenderItemstackToGui(dummySlot, x + pad + size / 2, y + size / 2, 100, size, ColorUtil.WhiteArgb, true, false, false); if (Texture == null) { Texture = new TextTextureUtil(capi).GenTextTexture(Name, CairoFont.WhiteSmallText()); } capi.Render.Render2DTexturePremultipliedAlpha( Texture.TextureId, (x + size + GuiElement.scaled(25)), y + size / 4 - 3, Texture.Width, Texture.Height, 50 ); }
/// <summary> /// Creates an ItemStackInfo element. /// </summary> /// <param name="capi">The client API</param> /// <param name="bounds">The bounds of the object.</param> /// <param name="OnRequireInfoText">The function that is called when an item information is called.</param> public GuiElementItemstackInfo(ICoreClientAPI capi, ElementBounds bounds, InfoTextDelegate OnRequireInfoText) : base(capi, "", CairoFont.WhiteSmallText(), bounds) { this.OnRequireInfoText = OnRequireInfoText; texture = new LoadedTexture(capi); ElementBounds textBounds = bounds.CopyOnlySize(); ElementBounds descBounds = textBounds.CopyOffsetedSibling(ItemStackSize + 50, MarginTop, -ItemStackSize - 50, 0); descBounds.WithParent(bounds); textBounds.WithParent(bounds); descriptionElement = new GuiElementRichtext(capi, new RichTextComponentBase[0], descBounds); //new GuiElementStaticText(capi, "", EnumTextOrientation.Left, textBounds.CopyOffsetedSibling(ItemStackSize + 50, MarginTop, -ItemStackSize - 50, 0), Font); descriptionElement.zPos = 1001; titleFont = Font.Clone(); titleFont.FontWeight = FontWeight.Bold; titleElement = new GuiElementRichtext(capi, new RichTextComponentBase[0], textBounds); titleElement.zPos = 1001; maxWidth = bounds.fixedWidth; }
/// <summary> /// Adds a dropdown to the current GUI instance. /// </summary> /// <param name="values">The values of the current drodown.</param> /// <param name="names">The names of those values.</param> /// <param name="selectedIndex">The default selected index.</param> /// <param name="onSelectionChanged">The event fired when the index is changed.</param> /// <param name="bounds">The bounds of the index.</param> /// <param name="key">The name of this dropdown.</param> public static GuiComposer AddDropDown(this GuiComposer composer, string[] values, string[] names, int selectedIndex, SelectionChangedDelegate onSelectionChanged, ElementBounds bounds, string key = null) { if (!composer.composed) { composer.AddInteractiveElement(new GuiElementDropDown(composer.Api, values, names, selectedIndex, onSelectionChanged, bounds, CairoFont.WhiteSmallText(), false), key); } return(composer); }
void ComposeInteractiveElements() { slotBounds = new ElementBounds[availableSlots.Count]; scissorBounds = new ElementBounds[availableSlots.Count]; slotQuantityTextures = new LoadedTexture[availableSlots.Count]; for (int k = 0; k < slotQuantityTextures.Length; k++) { slotQuantityTextures[k] = new LoadedTexture(this.api); } this.rows = (int)Math.Ceiling(1f * availableSlots.Count / cols); Bounds.CalcWorldBounds(); double unscaledSlotWidth = GuiElementPassiveItemSlot.unscaledSlotSize; double unscaledSlotHeight = GuiElementPassiveItemSlot.unscaledSlotSize; // Slot sizes double absSlotPadding = scaled(unscaledSlotPadding); double absSlotWidth = scaled(GuiElementPassiveItemSlot.unscaledSlotSize); double absSlotHeight = scaled(GuiElementPassiveItemSlot.unscaledSlotSize); ElementBounds textBounds = ElementBounds .Fixed(0, GuiElementPassiveItemSlot.unscaledSlotSize - GuiStyle.SmallishFontSize - 2, GuiElementPassiveItemSlot.unscaledSlotSize - 5, GuiElementPassiveItemSlot.unscaledSlotSize - 5) .WithEmptyParent(); CairoFont font = CairoFont.WhiteSmallText().WithFontSize((float)GuiStyle.SmallishFontSize); font.FontWeight = FontWeight.Bold; font.Color = new double[] { 1, 1, 1, 1 }; font.StrokeColor = new double[] { 0, 0, 0, 1 }; font.StrokeWidth = RuntimeEnv.GUIScale; textComposer = new GuiElementStaticText(api, "", EnumTextOrientation.Right, textBounds, font); // 1. draw generic slot ImageSurface slotSurface = new ImageSurface(Format.Argb32, (int)absSlotWidth, (int)absSlotWidth); Context slotCtx = genContext(slotSurface); slotCtx.SetSourceRGBA(GuiStyle.DialogSlotBackColor); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, GuiStyle.ElementBGRadius); slotCtx.Fill(); slotCtx.SetSourceRGBA(GuiStyle.DialogSlotFrontColor); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, GuiStyle.ElementBGRadius); slotCtx.LineWidth = scaled(4.5); slotCtx.Stroke(); slotSurface.Blur(scaled(4), true); slotSurface.Blur(scaled(4), true); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, 1); slotCtx.LineWidth = scaled(4.5); slotCtx.SetSourceRGBA(0, 0, 0, 0.8); slotCtx.Stroke(); generateTexture(slotSurface, ref slotTexture, true); slotCtx.Dispose(); slotSurface.Dispose(); // 2. draw slots with backgrounds foreach (var val in availableSlots) { ItemSlot slot = val.Value; string key = slot.BackgroundIcon + "-" + slot.HexBackgroundColor; if ((slot.BackgroundIcon == null && slot.HexBackgroundColor == null) || slotTextureIdsByBgIconAndColor.ContainsKey(key)) { continue; } slotSurface = new ImageSurface(Format.Argb32, (int)absSlotWidth, (int)absSlotWidth); slotCtx = genContext(slotSurface); if (slot.HexBackgroundColor != null) { double[] bgcolor = ColorUtil.Hex2Doubles(slot.HexBackgroundColor); slotCtx.SetSourceRGBA(bgcolor); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, GuiStyle.ElementBGRadius); slotCtx.Fill(); slotCtx.SetSourceRGBA(bgcolor[0] * 0.25, bgcolor[1] * 0.25, bgcolor[2] * 0.25, 1); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, GuiStyle.ElementBGRadius); slotCtx.LineWidth = scaled(4.5); slotCtx.Stroke(); slotSurface.Blur(scaled(4), true); slotSurface.Blur(scaled(4), true); slotCtx.SetSourceRGBA(0, 0, 0, 0.8); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, 1); slotCtx.LineWidth = scaled(4.5); slotCtx.Stroke(); } else { slotCtx.SetSourceRGBA(GuiStyle.DialogSlotBackColor); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, GuiStyle.ElementBGRadius); slotCtx.Fill(); slotCtx.SetSourceRGBA(GuiStyle.DialogSlotFrontColor); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, GuiStyle.ElementBGRadius); slotCtx.LineWidth = scaled(4.5); slotCtx.Stroke(); slotSurface.Blur(scaled(4), true); slotSurface.Blur(scaled(4), true); RoundRectangle(slotCtx, 0, 0, absSlotWidth, absSlotHeight, 1); slotCtx.LineWidth = scaled(4.5); slotCtx.SetSourceRGBA(0, 0, 0, 0.8); slotCtx.Stroke(); } if (slot.BackgroundIcon != null) { DrawIconHandler?.Invoke( slotCtx, slot.BackgroundIcon, 2 * (int)absSlotPadding, 2 * (int)absSlotPadding, (int)(absSlotWidth - 4 * absSlotPadding), (int)(absSlotHeight - 4 * absSlotPadding), new double[] { 0, 0, 0, 0.2 } ); } int texId = 0; generateTexture(slotSurface, ref texId, true); slotCtx.Dispose(); slotSurface.Dispose(); slotTextureIdsByBgIconAndColor[key] = texId; } // 3. Crossed out overlay int csize = (int)absSlotWidth - 4; slotSurface = new ImageSurface(Format.Argb32, (int)csize, (int)csize); slotCtx = genContext(slotSurface); slotCtx.SetSourceRGBA(0, 0, 0, 0.8); api.Gui.Icons.DrawCross(slotCtx, 4, 4, 7, csize - 18, true); slotCtx.SetSourceRGBA(1, 0.2, 0.2, 0.8); slotCtx.LineWidth = 2; slotCtx.Stroke(); generateTexture(slotSurface, ref crossedOutTexture); slotCtx.Dispose(); slotSurface.Dispose(); // 4. Slot highlight overlay slotSurface = new ImageSurface(Format.Argb32, (int)absSlotWidth + 4, (int)absSlotWidth + 4); slotCtx = genContext(slotSurface); slotCtx.SetSourceRGBA(GuiStyle.ActiveSlotColor); RoundRectangle(slotCtx, 0, 0, absSlotWidth + 4, absSlotHeight + 4, GuiStyle.ElementBGRadius); slotCtx.LineWidth = scaled(9); slotCtx.StrokePreserve(); slotSurface.Blur(scaled(6), true); slotCtx.StrokePreserve(); slotSurface.Blur(scaled(6), true); slotCtx.LineWidth = scaled(3); slotCtx.Stroke(); slotCtx.LineWidth = scaled(1); slotCtx.SetSourceRGBA(GuiStyle.ActiveSlotColor); slotCtx.Stroke(); generateTexture(slotSurface, ref highlightSlotTexture); slotCtx.Dispose(); slotSurface.Dispose(); int slotIndex = 0; foreach (var val in availableSlots) { int col = slotIndex % cols; int row = slotIndex / cols; double x = col * (unscaledSlotWidth + unscaledSlotPadding); double y = row * (unscaledSlotHeight + unscaledSlotPadding); ItemSlot slot = inventory[val.Key]; slotBounds[slotIndex] = ElementBounds.Fixed(x, y, unscaledSlotWidth, unscaledSlotHeight).WithParent(Bounds); slotBounds[slotIndex].CalcWorldBounds(); scissorBounds[slotIndex] = ElementBounds.Fixed(x + 2, y + 2, unscaledSlotWidth - 4, unscaledSlotHeight - 4).WithParent(Bounds); scissorBounds[slotIndex].CalcWorldBounds(); ComposeSlotOverlays(slot, val.Key, slotIndex); slotIndex++; } }
/// <summary> /// Reloads the values in the GUI. /// </summary> public void ReloadValues() { GuiComposer composer = Composers["cmdDlg" + settings.Code]; int elemKey = 1; for (int i = 0; i < settings.Rows.Length; i++) { DialogRow row = settings.Rows[i]; for (int j = 0; j < row.Elements.Length; j++) { DialogElement elem = row.Elements[j]; string currentValue = settings.OnGet?.Invoke(elem.Code); switch (elem.Type) { case EnumDialogElementType.Slider: { string key = "slider-" + elemKey; int curVal = 0; int.TryParse(currentValue, out curVal); composer.GetSlider(key).SetValues(curVal, elem.MinValue, elem.MaxValue, elem.Step); break; } case EnumDialogElementType.Switch: { string key = "switch-" + elemKey; composer.GetSwitch(key).SetValue(currentValue == "1"); } break; case EnumDialogElementType.Input: { string key = "input-" + elemKey; CairoFont font = CairoFont.WhiteSmallText(); composer.GetTextInput(key).SetValue(currentValue); break; } case EnumDialogElementType.NumberInput: { string key = "numberinput-" + elemKey; composer.GetNumberInput(key).SetValue(currentValue); break; } case EnumDialogElementType.Button: break; case EnumDialogElementType.Text: break; case EnumDialogElementType.Select: case EnumDialogElementType.DynamicSelect: { string[] values = elem.Values; if (elem.Type == EnumDialogElementType.DynamicSelect) { string[] compos = currentValue.Split(new string[] { "\n" }, StringSplitOptions.None); values = compos[0].Split(new string[] { "||" }, StringSplitOptions.None); string[] names = compos[1].Split(new string[] { "||" }, StringSplitOptions.None); currentValue = compos[2]; string key = "dropdown-" + elemKey; composer.GetDropDown(key).SetList(values, names); } int selectedIndex = Array.FindIndex(values, w => w.Equals(currentValue)); if (elem.Mode == EnumDialogElementMode.DropDown) { string key = "dropdown-" + elemKey; composer.GetDropDown(key).SetSelectedIndex(selectedIndex); } else { if (elem.Icons != null && elem.Icons.Length > 0) { string key = "togglebuttons-" + elemKey; if (currentValue != null && currentValue.Length > 0) { composer.ToggleButtonsSetValue(key, selectedIndex); } } } } break; } elemKey++; } } }
private void ComposeElement(GuiComposer composer, JsonDialogSettings settings, DialogElement elem, int elemKey, double x, double y) { double factor = settings.SizeMultiplier; double labelWidth = 0; if (elem.Label != null) { CairoFont font = CairoFont.WhiteSmallText(); font.UnscaledFontsize *= factor; TextExtents extents = font.GetTextExtents(elem.Label); labelWidth = extents.Width / factor / RuntimeEnv.GUIScale + 1; FontExtents fext = font.GetFontExtents(); ElementBounds labelBounds = ElementBounds.Fixed(x, y + Math.Max(0, (elem.Height * factor - fext.Height / RuntimeEnv.GUIScale) / 2), labelWidth, elem.Height).WithScale(factor); composer.AddStaticText(elem.Label, font, labelBounds); labelWidth += 8; if (elem.Tooltip != null) { CairoFont tfont = CairoFont.WhiteSmallText(); tfont.UnscaledFontsize *= factor; composer.AddHoverText(elem.Tooltip, tfont, 350, labelBounds.FlatCopy(), "tooltip-" + elem.Code); composer.GetHoverText("tooltip-" + elem.Code).SetAutoWidth(true); } } ElementBounds bounds = ElementBounds.Fixed(x + labelWidth, y, elem.Width - labelWidth, elem.Height).WithScale(factor); string currentValue = settings.OnGet?.Invoke(elem.Code); switch (elem.Type) { case EnumDialogElementType.Slider: { string key = "slider-" + elemKey; composer.AddSlider((newval) => { settings.OnSet?.Invoke(elem.Code, newval + ""); return(true); }, bounds, key); int curVal = 0; int.TryParse(currentValue, out curVal); composer.GetSlider(key).SetValues(curVal, elem.MinValue, elem.MaxValue, elem.Step); composer.GetSlider(key).Scale = factor; //composer.GetSlider(key).TriggerOnlyOnMouseUp(true); break; } case EnumDialogElementType.Switch: { string key = "switch-" + elemKey; composer.AddSwitch((newval) => { settings.OnSet?.Invoke(elem.Code, newval ? "1" : "0"); }, bounds, key, 30 * factor, 5 * factor); composer.GetSwitch(key).SetValue(currentValue == "1"); } break; case EnumDialogElementType.Input: { string key = "input-" + elemKey; CairoFont font = CairoFont.WhiteSmallText(); font.UnscaledFontsize *= factor; composer.AddTextInput(bounds, (newval) => { settings.OnSet?.Invoke(elem.Code, newval); }, font, key); composer.GetTextInput(key).SetValue(currentValue); break; } case EnumDialogElementType.NumberInput: { string key = "numberinput-" + elemKey; CairoFont font = CairoFont.WhiteSmallText(); font.UnscaledFontsize *= factor; composer.AddNumberInput(bounds, (newval) => { settings.OnSet?.Invoke(elem.Code, newval); }, font, key); composer.GetNumberInput(key).SetValue(currentValue); break; } case EnumDialogElementType.Button: if (elem.Icon != null) { composer.AddIconButton(elem.Icon, (val) => { settings.OnSet?.Invoke(elem.Code, null); }, bounds); } else { CairoFont font = CairoFont.ButtonText(); font.WithFontSize(elem.FontSize); composer.AddButton(elem.Text, () => { settings.OnSet?.Invoke(elem.Code, null); return(true); }, bounds.WithFixedPadding(8, 0), font); } if (elem.Tooltip != null && elem.Label == null) { CairoFont tfont = CairoFont.WhiteSmallText(); tfont.UnscaledFontsize *= factor; composer.AddHoverText(elem.Tooltip, tfont, 350, bounds.FlatCopy(), "tooltip-" + elem.Code); composer.GetHoverText("tooltip-" + elem.Code).SetAutoWidth(true); } break; case EnumDialogElementType.Text: composer.AddStaticText(elem.Text, CairoFont.WhiteMediumText().WithFontSize(elem.FontSize), bounds); break; case EnumDialogElementType.Select: case EnumDialogElementType.DynamicSelect: { string[] values = elem.Values; string[] names = elem.Names; if (elem.Type == EnumDialogElementType.DynamicSelect) { string[] compos = currentValue.Split(new string[] { "\n" }, StringSplitOptions.None); values = compos[0].Split(new string[] { "||" }, StringSplitOptions.None); names = compos[1].Split(new string[] { "||" }, StringSplitOptions.None); currentValue = compos[2]; } int selectedIndex = Array.FindIndex(values, w => w.Equals(currentValue)); if (elem.Mode == EnumDialogElementMode.DropDown) { string key = "dropdown-" + elemKey; composer.AddDropDown(values, names, selectedIndex, (newval, on) => { settings.OnSet?.Invoke(elem.Code, newval); }, bounds, key); composer.GetDropDown(key).Scale = factor; composer.GetDropDown(key).Font.UnscaledFontsize *= factor; } else { if (elem.Icons != null && elem.Icons.Length > 0) { ElementBounds[] manybounds = new ElementBounds[elem.Icons.Length]; double elemHeight = (elem.Height - 4 * elem.Icons.Length) / elem.Icons.Length; for (int i = 0; i < manybounds.Length; i++) { manybounds[i] = bounds.FlatCopy().WithFixedHeight(elemHeight - 4).WithFixedOffset(0, i * (4 + elemHeight)).WithScale(factor); } string key = "togglebuttons-" + elemKey; CairoFont font = CairoFont.WhiteSmallText(); font.UnscaledFontsize *= factor; composer.AddIconToggleButtons(elem.Icons, font, (newval) => { settings.OnSet?.Invoke(elem.Code, elem.Values[newval]); }, manybounds, key); if (currentValue != null && currentValue.Length > 0) { composer.ToggleButtonsSetValue(key, selectedIndex); } if (elem.Tooltips != null) { for (int i = 0; i < elem.Tooltips.Length; i++) { CairoFont tfont = CairoFont.WhiteSmallText(); tfont.UnscaledFontsize *= factor; composer.AddHoverText(elem.Tooltips[i], tfont, 350, manybounds[i].FlatCopy()); } } } } } break; } elementNumber++; }
public void Recompose(ICoreClientAPI capi) { Texture?.Dispose(); Texture = new TextTextureUtil(capi).GenTextTexture(Lang.Get(Title), CairoFont.WhiteSmallText()); }