/// <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);
        }
        /// <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);
        }
Example #3
0
 public BlockSettings(Engine engine, Block block)
     : base("Block Settings")
 {
     this.block = block;
     this.DemandPriority = true;
     CullingButton = new ScreenButton(this, "Toggle Culling", "Culling: False", engine.FontMain);
     AddElement(CullingButton);
     SolidButton = new ScreenButton(this, "Toggle Solid", "Solid: False", engine.FontMain);
     AddElement(SolidButton);
     AddCloseButton(engine);
     Center(engine);
     UpdateButtons();
 }
Example #4
0
        public BlockDesigner(Engine engine, Tileset tileset, BlockPlacer parentScreen, Block block)
            : base("Block Designer")
        {
            this.parentScreen = parentScreen;
            this.tileset = tileset;
            this.EditMode = true;
            this.CurrentBlock = block;

            SetUpScreen(engine);

            ScreenButton _but = new ScreenButton(this, "Delete", "Del", engine.FontMain);
            _but.Position.X = Screen.boarderSize * 6 + 2 * 32 + 48 + 64 + 48;
            _but.Position.Y = PrevBox.Y + PrevBoxSize + boarderSize;;
            _but.Size.X = 32;
            this.AddElement(_but);
        }
Example #5
0
        private void SetUpScreen(Engine engine)
        {
            this.Size.X = 320;
            this.AddCloseButton(engine);
            this.DemandPriority = true;

            Vector2 _tl = new Vector2(Screen.boarderSize, Screen.boarderSize + Screen.headerSize);
            Vector2 _sz = new Vector2(32, 32);
            Vector2 _left = new Vector2(32, 0);
            Vector2 _down = new Vector2(0, 32);
            BBack = new ScreenPictureButton(this, "Set Back", engine.textureManager.Dic["backarrow"], _tl, _sz);
            BTop = new ScreenPictureButton(this, "Set Top", engine.textureManager.Dic["uparrow"], _tl + _left, _sz);
            BLeft = new ScreenPictureButton(this, "Set Left", engine.textureManager.Dic["leftarrow"], _tl + _down, _sz);
            BRight = new ScreenPictureButton(this, "Set Right", engine.textureManager.Dic["rightarrow"], _tl + _down + _left * 2, _sz);
            BFront = new ScreenPictureButton(this, "Set Front", engine.textureManager.Dic["frontarrow"], _tl + _down + _left, _sz);
            BBottom = new ScreenPictureButton(this, "Set Bottom", engine.textureManager.Dic["downarrow"], _tl + _down * 2 + _left, _sz);
            this.AddElement(BBack);
            this.AddElement(BTop);
            this.AddElement(BLeft);
            this.AddElement(BRight);
            this.AddElement(BFront);
            this.AddElement(BBottom);

            UpdateButtonColor();

            TextureSelector = new ScreenTextureSelector(engine, this);
            AddElement(TextureSelector);

            float _butHeight = PrevBox.Y + PrevBoxSize + boarderSize;
            ScreenButton _but = new ScreenButton(this, "Name", engine.FontMain);
            _but.Position.X = Screen.boarderSize * 3 + 2 * 32;
            _but.Position.Y = _butHeight;
            _but.Size.X = 48;
            this.AddElement(_but);
            _but = new ScreenButton(this, "Settings", engine.FontMain);
            _but.Position.X = Screen.boarderSize * 4 + 2 * 32 + 48;
            _but.Position.Y = _butHeight;
            _but.Size.X = 64;
            this.AddElement(_but);
            _but = new ScreenButton(this, "Save", engine.FontMain);
            _but.Position.X = Screen.boarderSize * 5 + 2 * 32 + 48 + 64;
            _but.Position.Y = _butHeight;
            _but.Size.X = 48;
            this.AddElement(_but);

            UpdateHeader();
        }
Example #6
0
        /// <summary>
        /// Constructs a block selector window.
        /// </summary>
        public BlockPlacer(Engine engine, LevelEditor parentEditor)
            : base("Block Selector")
        {
            this.parentEditor = parentEditor;

            ScreenButton _but = new ScreenButton(this, "Back", "<", engine.FontMain);
            _but.Position.X = boarderSize;
            _but.Size.X = 32;
            ElementList.Add(_but);
            _but = new ScreenButton(this, "Forward", ">", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize;
            _but.Size.X = 32;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);
            _but = new ScreenButton(this, "New Block", "New", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize;
            _but.Size.X = 48;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);
            _but = new ScreenButton(this, "Edit Block", "Edit", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize + 48 + boarderSize;
            _but.Size.X = 48;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);
            _but = new ScreenButton(this, "Save/Load", "Sv/Ld", engine.FontMain);
            _but.Position.X = boarderSize + 32 + boarderSize + 32 + boarderSize + 48 + boarderSize + 48 + boarderSize;
            _but.Size.X = 48;
            _but.Position.Y = headerSize + boarderSize;
            ElementList.Add(_but);

            InputField = new ScreenInput(this, engine.FontMain);
            AddElement(InputField);

            PrevPosition = new Vector2((Size.X - PrevBoxWidth * PrevMaximumColumns) / 2, GetTotalElementHeight());
            this.Size.Y = PrevPosition.Y + Screen.boarderSize + PrevMaximumRows * PrevBoxHeight;

            FilterBlocks(engine);

            this.Position = new Vector2(engine.windowSize.X - this.Size.X, 0);
        }
Example #7
0
 /// <summary>
 /// Adds a close button to the window.
 /// </summary>
 public void AddCloseButton(Engine engine)
 {
     ScreenButton _button = new ScreenButton(this, "Close", "X", engine.FontMain);
     _button.Position = new Vector2(this.Size.X - headerSize, 0);
     _button.Size = new Vector2(headerSize, headerSize);
     ElementList.Add(_button);
 }