Esempio n. 1
0
        public static GuiComposer AddAutoSizeHoverText(this GuiComposer composer, string text, CairoFont font, int width, ElementBounds bounds, string key = null)
        {
            if (!composer.composed)
            {
                GuiElementHoverText elem = new GuiElementHoverText(composer.Api, text, font, width, bounds, null);
                elem.SetAutoWidth(true);

                composer.AddInteractiveElement(elem, key);
            }
            return(composer);
        }
Esempio n. 2
0
        /// <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);
        }