protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as MenuActionsControl;

            if (display.AvailableActions.Count > 1)
            {
                BLT.Font("text");
                BLTLayers.Set(BLTLayers.Text, display.ActivityIndex);

                BLT.Color(display.Color);

                var x = control.Position.X;
                var y = control.Position.Y;

                BLT.Print(x, y, "[[");
                x += BLT.Measure("[[").Width;

                foreach (var action in display.AvailableActions)
                {
                    if (action == display.SelectedAction)
                    {
                        BLT.Color(display.SelectedColor);
                    }
                    BLT.Print(x, y, action.ToString());
                    BLT.Color("");

                    x += BLT.Measure(action.ToString()).Width;
                    BLT.Print(x, y, "|");
                    x += BLT.Measure("|").Width;
                }

                x -= BLT.Measure("|").Width;
                BLT.Print(x, y, "]]");
            }
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var messageLog = control as MessageLogControl;

            var numberOfMessages = messageLog.NumberOfMessages;

            BLTLayers.Set(BLTLayers.Text, control.ActivityIndex);
            BLT.Font("text");

            var messagesToRender = systemContainer.MessageSystem.RecentMessages(numberOfMessages);

            messagesToRender.Reverse();

            var x = control.Position.Left;
            var y = control.Position.Bottom;

            foreach (var message in messagesToRender)
            {
                var size = BLT.Measure(message.Text);
                y -= size.Height + 1;

                BLT.Color(message.Color);
                BLT.Print(x, y, message.Text);
            }

            BLT.Color("");
            BLT.Font("");
        }
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var display = control as MenuActionsControl;
            var text    = $"[[{string.Join("|", display.AvailableActions.Select(a => a.ToString()))}]]";

            BLT.Font("text");
            var size = BLT.Measure(text);

            return(size);
        }
        protected static void RenderText(int x, int y, int activityIndex, out Size textSize, string text, Color color, bool updateY = true, string font = "text")
        {
            BLTLayers.Set(BLTLayers.Text, activityIndex);
            BLT.Font(font);
            BLT.Color(color);
            BLT.Print(x, y, text);
            textSize         = BLT.Measure(text);
            textSize.Height += 1;

            BLT.Color("");
        }
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var display = control as MultipleChoiceFormData;

            var text = display.Value.ToString();

            BLT.Font("text");

            var textSize = BLT.Measure(text);

            return(new Size(textSize.Width + 6, textSize.Height));
        }
示例#6
0
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl display, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var statsControl = (display as IDataRogueInfoControl);
            var entity       = statsControl.Entity;

            BLT.Font("textLarge");
            var textSize = BLT.Measure(entity.GetBLTName());

            BLT.Font("");

            return(new Size(Math.Max(60, textSize.Width + 22), Height));
        }
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var display = control as IDataRogueInfoControl;
            var text    = display.Parameters;

            BLT.Font("textLarge");

            var size = BLT.Measure(text);

            size.Height += 1;

            return(size);
        }
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var display = control as StatsFormData;

            var stats = display.Stats;

            var statTotal = $"[[{display.CurrentTotalStat.ToString().PadLeft(4)}/{display.MaxTotalStat.ToString().PadRight(4)}]]";

            var statTotalSize = BLT.Measure(statTotal);

            var longestStat = stats.Max(s => BLT.Measure(s.statName).Width);
            var longest     = Math.Max(longestStat, statTotalSize.Width);

            return(new Size(longest, 4 * (stats.Count + 1)));
        }
示例#9
0
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var display = control as IDataRogueInfoControl;
            var entity  = display.Entity;

            var experience = entity.Get <Experience>();

            var text1 = $"Level: {experience.Level}";
            var text2 = $"   XP: {experience.Amount}";

            BLT.Font("");
            var size1 = BLT.Measure(text1);
            var size2 = BLT.Measure(text2);

            return(new Size(Math.Max(size1.Width, size2.Width), size1.Height + size2.Height));
        }
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            BLT.Font("text");

            var textSize = BLT.Measure(new String('@', 30));

            var textBoxSize = textSize.Width + 4;

            if (textBoxSize % TILE_SIZE != 0)
            {
                textBoxSize = (textBoxSize / TILE_SIZE + 1) * TILE_SIZE;
            }

            var numberOfTiles = textBoxSize / TILE_SIZE;

            return(new Size(numberOfTiles * TILE_SIZE, TILE_SIZE));
        }
示例#11
0
        protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
        {
            var display = control as ButtonControl;

            BLT.Font("text");

            var textSize   = BLT.Measure(display.Text).Width;
            var buttonSize = textSize + 4;

            if (buttonSize % 8 != 0)
            {
                buttonSize = (buttonSize / 8 + 1) * 8;
            }

            var numberOfTiles = buttonSize / 8;

            return(new Size(8 * numberOfTiles, 8));
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var x    = control.Position.X;
            var y    = control.Position.Y;
            var text = (control as TextFormData).Value.ToString();

            var spriteSheet = spriteManager.Get(control.IsFocused ? "textbox_white_small" : "textbox_grey_small");

            BLTLayers.Set(BLTLayers.Text, control.ActivityIndex);
            BLT.Font("text");

            BLT.Print(x + 4, y, text);

            var textSize = BLT.Measure(new String('@', 30));

            var textBoxSize = textSize.Width + 4;

            if (textBoxSize % TILE_SIZE != 0)
            {
                textBoxSize = (textBoxSize / TILE_SIZE + 1) * TILE_SIZE;
            }

            var numberOfTiles = textBoxSize / TILE_SIZE;

            BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
            BLT.Font("");

            for (int i = 0; i < numberOfTiles; i++)
            {
                TileDirections direction = TileDirections.None;
                if (i != 0)
                {
                    direction |= TileDirections.Left;
                }

                if (i != numberOfTiles - 1)
                {
                    direction |= TileDirections.Right;
                }

                BLT.PutExt(x + TILE_SIZE * i, y - 2, 0, -2, spriteSheet.Tile(direction));
            }
        }
示例#13
0
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display     = control as ButtonControl;
            var x           = control.Position.X;
            var y           = control.Position.Y;
            var pressed     = control.IsPressed;
            var focused     = control.IsFocused;
            var spriteSheet = focused ? spriteManager.Get("button_pressed") : spriteManager.Get("button_unpressed");

            BLT.Font("text");

            var textSize   = BLT.Measure(display.Text).Width;
            var buttonSize = textSize + 4;

            if (buttonSize % 8 != 0)
            {
                buttonSize = (buttonSize / 8 + 1) * 8;
            }

            var numberOfTiles = buttonSize / 8;

            BLT.Font("");
            BLTLayers.Set((int)BLTLayers.UIElements, control.ActivityIndex);
            for (int i = 0; i < numberOfTiles; i++)
            {
                TileDirections direction = TileDirections.None;
                if (i != 0)
                {
                    direction |= TileDirections.Left;
                }

                if (i != numberOfTiles - 1)
                {
                    direction |= TileDirections.Right;
                }

                BLT.Put(x + 8 * i, y, spriteSheet.Tile(direction));
            }

            BLT.Font("text");
            BLTLayers.Set((int)BLTLayers.Text, control.ActivityIndex);
            BLT.Print(x + buttonSize / 2 - textSize / 2, y + (focused ? 3 : 2), display.Text);
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as MultipleChoiceFormData;
            var x       = control.Position.X;
            var y       = control.Position.Y;

            BLT.Font("text");
            var text     = display.Value.ToString();
            var textSize = BLT.Measure(text);

            BLT.Print(x + 10, y, text);

            if (control.IsFocused)
            {
                BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
                BLT.Font("");
                BLT.Put(x, y - 2, spriteManager.Tile("ui_arrow", TileDirections.Left));
                BLT.Put(x + textSize.Width + 12, y - 2, spriteManager.Tile("ui_arrow", TileDirections.Right));
            }
        }
        protected override void DisplayInternal(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov)
        {
            var display = control as StatsFormData;
            var x       = display.Position.X;
            var y       = display.Position.Y;

            var stats = display.Stats;

            var statTotal = $"[[{display.CurrentTotalStat.ToString().PadLeft(4)}/{display.MaxTotalStat.ToString().PadRight(4)}]]";

            BLT.Print(16 + x, y, statTotal);

            var longestStat = stats.Max(s => BLT.Measure(s.statName).Width);

            y += 4;

            foreach (var stat in stats)
            {
                var statSelected = display.SubSelection == stat.statName;

                BLT.Print(12, y, (stat.statName + ": ").PadRight(longestStat + 2));
                BLT.Print(12 + longestStat + 4, y, (statSelected ? "[color=red]" : "") + "-");
                BLT.Print(12 + longestStat + 8, y, stat.statValue.ToString().PadBoth(4));
                BLT.Print(12 + longestStat + 16, y, (statSelected ? "[color=green]" : "") + "+");

                if (statSelected)
                {
                    BLTLayers.Set(BLTLayers.UIElements, control.ActivityIndex);
                    BLT.Font("");
                    BLT.Put(6, y, spriteManager.Tile("selector_left", TileDirections.Left));
                    BLTLayers.Set(BLTLayers.Text, control.ActivityIndex);
                    BLT.Font("text");
                }

                y += 4;
            }
        }
示例#16
0
 protected override Size Measure(ISpriteManager spriteManager, IDataRogueControl control, ISystemContainer systemContainer, List <MapCoordinate> playerFov, Rectangle boundingBox, Padding padding, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
 {
     BLT.Font("text");
     return(BLT.Measure(GetText(control, systemContainer, playerFov)));
 }
        private void PrintTextCentered(string text, int x, int y)
        {
            var textWidth = BLT.Measure(text).Width;

            BLT.Print(x - textWidth / 2, y, text);
        }