/// <summary>
        /// The constructor for this selector.
        /// </summary>
        public ScreenTextureSelector(Engine engine, Screen screen)
            : base(screen)
        {
            // Adds the page forward and back buttons to the screen.
            int          _buttonHeight = screen.GetTotalElementHeight();
            ScreenButton _but          = new ScreenButton(screen, "Back", "<", engine.FontMain);

            _but.Position.X = Screen.boarderSize;
            _but.Size.X     = 32;
            _but.Position.Y = _buttonHeight;
            screen.ElementList.Add(_but);
            _but            = new ScreenButton(screen, "Forward", ">", engine.FontMain);
            _but.Position.X = Screen.boarderSize + 32 + Screen.boarderSize;
            _but.Size.X     = 32;
            _but.Position.Y = _buttonHeight;
            screen.ElementList.Add(_but);

            // Creates a new input field and adds it to the screen.
            this.InputField = new ScreenInput(screen, engine.FontMain);
            screen.AddElement(InputField);

            // Resizes and places the bread and butter of this element.
            this.Position.Y = screen.GetTotalElementHeight();
            this.Size.Y     = 128;

            // Determines the max rows and columns that will fit.
            this.PrevMaximumColumns = (int)Math.Floor(Size.X / TilePreviewSize);
            this.PrevMaximumRows    = (int)Math.Floor(Size.Y / TilePreviewSize);

            // Creates new lists to display.
            FilterTiles(engine);
        }
Esempio n. 2
0
        public Element(Screen owner, Container container, int depth, bool multiclick = false)
        {
            Screen = owner;
            Screen.AddElement(this);
            ID = latestID++;

            this.multiClick = multiclick;
            this._Depth     = depth;
            this.Container  = container;

            Container.Initialize(this);
            Container.UpdateRequired += () => IsDirty = true;
        }
        /// <summary>
        /// The constructor for this selector.
        /// </summary>
        public ScreenTextureSelector(Engine engine, Screen screen)
            : base(screen)
        {
            // Adds the page forward and back buttons to the screen.
            int _buttonHeight = screen.GetTotalElementHeight();
            ScreenButton _but = new ScreenButton(screen, "Back", "<", engine.FontMain);
            _but.Position.X = Screen.boarderSize;
            _but.Size.X = 32;
            _but.Position.Y = _buttonHeight;
            screen.ElementList.Add(_but);
            _but = new ScreenButton(screen, "Forward", ">", engine.FontMain);
            _but.Position.X = Screen.boarderSize + 32 + Screen.boarderSize;
            _but.Size.X = 32;
            _but.Position.Y = _buttonHeight;
            screen.ElementList.Add(_but);

            // Creates a new input field and adds it to the screen.
            this.InputField = new ScreenInput(screen, engine.FontMain);
            screen.AddElement(InputField);

            // Resizes and places the bread and butter of this element.
            this.Position.Y = screen.GetTotalElementHeight();
            this.Size.Y = 128;

            // Determines the max rows and columns that will fit.
            this.PrevMaximumColumns = (int)Math.Floor(Size.X / TilePreviewSize);
            this.PrevMaximumRows = (int)Math.Floor(Size.Y / TilePreviewSize);

            // Creates new lists to display.
            FilterTiles(engine);
        }