Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the GuiScrollList with a vertain number of text images.
        /// </summary>
        /// <param name="items">The text items to display.</param>
        /// <param name="width">The width of one text item.</param>
        /// <param name="height">The height of one text item.</param>
        /// <param name="font">The font to use for the text.</param>
        /// <param name="textColor">The color of the text.</param>
        /// <param name="outlineColor">The color of the outline or 0.</param>
        public void InitImages(string[] items, int width, int height, System.Drawing.Font font, int textColor, int outlineColor)
        {
            ITexture2d texture = Text.Create(items, width, height, font, textColor, outlineColor);

            SubTexture[] textures = SubTexture.Create(texture, items.Length, 1);
            images = new Image[textures.Length];
            for (int i = 0; i < textures.Length; i++)
            {
                images[i] = new Image(textures[i]);
            }
            Init(images);
            SetSize(images[0].Size);
        }
Ejemplo n.º 2
0
        //---------------------------------------------------------------
        #endregion
        //---------------------------------------------------------------

        //---------------------------------------------------------------
        #region Initialisation
        //---------------------------------------------------------------
        /// <summary>
        /// Creates a new GuiScrollList element.
        /// </summary>
        public GuiScrollList(int totalNum, int columns, ITexture2d normal, ITexture2d hover, ITexture2d selected)
        {
            isInfinite = false;

            SubTexture[] subTexturesNormal   = SubTexture.Create(normal, totalNum, columns);
            SubTexture[] subTexturesHover    = SubTexture.Create(hover, totalNum, columns);
            SubTexture[] subTexturesSelected = SubTexture.Create(selected, totalNum, columns);

            Button[] buttons = new Button[subTexturesNormal.Length];

            for (int i = 0; i < buttons.Length; i++)
            {
                buttons[i] = new Button(subTexturesNormal[i], subTexturesSelected[i], subTexturesHover[i]);
            }
            Init(images);
        }
Ejemplo n.º 3
0
        //---------------------------------------------------------------
        #endregion
        //---------------------------------------------------------------

        //---------------------------------------------------------------
        #region Initialisation
        //---------------------------------------------------------------
        /// <summary>
        /// Creates a new GuiListBox object.
        /// </summary>
        /// <param name="items">The number of items.</param>
        /// <param name="background">The background texture.</param>
        /// <param name="hover">The hover texture.</param>
        /// <param name="selected">The selected texture.</param>
        public GuiListBox(int items, ITexture2d background, ITexture2d hover, ITexture2d selected)
        {
            this.background = background;
            this.hover      = hover;
            this.selected   = selected;

            this.images = new Image[items];
            states      = new ButtonState[items];
            for (int i = 0; i < images.Length; i++)
            {
                SubTexture subTexture = SubTexture.Create(background, i, items, 1);
                images[i]          = new Image(subTexture);
                images[i].Position = Vector2.MultiplyElements(images[i].Size, new Vector2(0.0f, i));
                this.Children.Add(images[i]);
            }
            this.size = Vector2.MultiplyElements(images[0].Size, new Vector2(1, items));
        }