Example #1
0
        public static void DrawImage(this CellSurface surface, int x, int y, SymbolsImage image, Color defaultForeColor, Color defaultBackColor)
        {
            for (int posY = 0; posY < image.Height; posY++)
            {
                for (int posX = 0; posX < image.Width; posX++)
                {
                    var pixel     = image[posX, posY];
                    var backColor = pixel.BackgroundColor?.ToXna() ?? defaultBackColor;

                    var printX = x + posX;
                    var printY = y + posY;

                    if (pixel.Symbol.HasValue)
                    {
                        var foreColor = pixel.Color?.ToXna() ?? defaultForeColor;
                        surface.Print(printX, printY,
                                      new ColoredGlyph(pixel.Symbol.Value, foreColor, backColor));
                    }
                    else
                    {
                        surface.Print(printX, printY, new ColoredGlyph(' ', defaultForeColor, backColor));
                    }
                }
            }
        }
        private void DrawCellManaLevel(CellSurface surface)
        {
            const int yPos = 15;

            var cell = game.Map.GetCell(game.PlayerPosition);

            surface.Print(2, yPos, "Area Mana");

            var manaBarLength           = Width - 3;
            var manaLevelPercent        = (float)cell.MagicEnergyLevel() / cell.MaxMagicEnergyLevel();
            var disturbanceLevelPercent = (float)cell.MagicDisturbanceLevel() / cell.MaxMagicEnergyLevel();

            var manaLevelLength        = (int)Math.Floor(manaBarLength * manaLevelPercent);
            var disturbanceLevelLength = (int)Math.Ceiling(manaBarLength * disturbanceLevelPercent);
            var leftLength             = manaBarLength - (manaLevelLength + disturbanceLevelLength);

            var shiftX = 2;

            for (int i = 0; i < disturbanceLevelLength; i++)
            {
                surface.Print(shiftX + i, yPos + 1, new ColoredGlyph(Glyphs.GetGlyph('.'), Color.Black, Color.BlueViolet));
            }

            shiftX += disturbanceLevelLength;
            for (int i = 0; i < leftLength; i++)
            {
                surface.Print(shiftX + i, yPos + 1, new ColoredGlyph(Glyphs.GetGlyph('.'), Color.Black, Color.DarkBlue));
            }

            shiftX += leftLength;
            for (int i = 0; i < manaLevelLength; i++)
            {
                surface.Print(shiftX + i, yPos + 1, new ColoredGlyph(Glyphs.GetGlyph('.'), Color.Black, Color.DeepSkyBlue));
            }
        }
Example #3
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            const int dX = 5;

            surface.Print(dX, 2, $"You has reached level {Level}!");
            surface.Print(dX, 3, "Please select stat you want to increase:");

            DoForAllStats((y, stat) =>
            {
                var name = TextHelper.GetStatName(stat);
                name     = $"{name}:";
                while (name.Length < maxStatNameLength)
                {
                    name += " ";
                }

                surface.Print(dX, y, name);
                surface.Print(dX + maxStatNameLength + 2, y, StatsValue[stat].ToString());
            });

            const int dY = 6;

            for (var index = 0; index < stats.Length; index++)
            {
                var stat = stats[index];
                var y    = dY + index * 4;
                PrintStatStatus(5, y, stat, surface);
            }
        }
Example #4
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(1, 1, "Open Image");
            surface.Clear(new Rectangle(1, 2, Width - 2, 2));
            surface.Print(1, 2, Path);
        }
Example #5
0
        private void PrintPlayerStats(int dX, int dY, CellSurface surface)
        {
            surface.Print(dX, dY, "Stats:");

            var stats     = Enum.GetValues(typeof(PlayerStats)).Cast <PlayerStats>().ToArray();
            var maxLength = stats.Select(TextHelper.GetStatName).Select(name => name.Length).Max();

            for (var index = 0; index < stats.Length; index++)
            {
                var stat = stats[index];

                var pureValue  = Player.GetPureStat(stat);
                var bonusValue = Player.Equipment.GetStatsBonus(stat);

                var name = TextHelper.GetStatName(stat);

                var y = dY + 2 + index;
                surface.Print(dX, y, name);
                var bonusText = new StyledLine
                {
                    pureValue.ToString()
                };
                if (bonusValue != 0)
                {
                    var bonusSymbol = bonusValue > 0 ? "+" : "-";
                    var bonusColor  = bonusValue > 0 ? TextHelper.PositiveValueColor : TextHelper.NegativeValueColor;
                    bonusText.Add(" (");
                    bonusText.Add($"{bonusSymbol}{bonusValue}", bonusColor);
                    bonusText.Add(")");
                }
                surface.PrintStyledText(dX + maxLength + 1, y, bonusText.ToColoredString(DefaultBackground));
            }

            var xPos = dX + maxLength + 10;

            surface.PrintStyledText(xPos, dY + 2, new StyledLine {
                "Max Health           ", new StyledString(Player.MaxHealth.ToString(), TextHelper.HealthColor)
            }.ToColoredString(DefaultBackground));
            surface.PrintStyledText(xPos, dY + 3, new StyledLine {
                "Max Mana             ", new StyledString(Player.MaxMana.ToString(), TextHelper.ManaColor)
            }.ToColoredString(DefaultBackground));
            surface.PrintStyledText(xPos, dY + 4, new StyledLine {
                "Mana Regeneration    ", new StyledString(Player.ManaRegeneration.ToString(), TextHelper.ManaRegenerationColor)
            }.ToColoredString(DefaultBackground));
            surface.PrintStyledText(xPos, dY + 5, new StyledLine {
                "Dodge Chance         ", $"{Player.DodgeChance}%"
            }.ToColoredString(DefaultBackground));

            surface.PrintStyledText(dX, dY + 4 + stats.Length, new StyledLine {
                $"Level: {Player.Level}"
            }.ToColoredString(DefaultBackground));
            surface.PrintStyledText(dX, dY + 5 + stats.Length, new StyledLine {
                "XP:    ", new StyledString($"{Player.Experience} / {Player.GetXpToLevelUp()}", TextHelper.XpColor)
            }.ToColoredString(DefaultBackground));
        }
Example #6
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(3, 2, "Edit spell file, fill all data and click OK to continue.");
            surface.Print(3, 4, "Spell Name:");
            surface.Print(3, 7, "Mana Cost:");

            surface.Print(3, Height - 5,
                          new ColoredString("Don't forget to save spell file changes before pressing OK.",
                                            new Cell(Color.Red, DefaultBackground)));
        }
Example #7
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            // Journal box frame
            surface.Print(0, Height - 11, new ColoredGlyph(Glyphs.GetGlyph('╟'), FrameColor, DefaultBackground));
            surface.Print(1, Height - 11, new ColoredGlyph(Glyphs.GetGlyph('─'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, Height - 11, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));

            // Player stats frame
            surface.Print(Width - 40, 0, new ColoredGlyph(Glyphs.GetGlyph('╤'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, 3, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));
        }
Example #8
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(2, 1, "Game Settings");

            surface.Print(2, 4, "Spell Editor Application:");
            surface.Print(2, 5, new ColoredString(SpellEditorPath, new Cell(Color.Gray, DefaultBackground)));

            surface.Print(2, 10, "Font Size:");
            surface.Clear(15, 10, 10);
            surface.Print(15, 10, new ColoredString(FontSizeName, Color.Gray, DefaultBackground));
        }
Example #9
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(2, 1, "Player Status");

            surface.Fill(1, 2, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('─'));
            surface.Print(0, 2, new ColoredGlyph(Glyphs.GetGlyph('╟'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, 2, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));

            PrintProtection(2, 4, surface);
            PrintPlayerStats(25, 4, surface);
            PrintWeapon(2, 20, surface);
        }
Example #10
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Fill(Color.White, Color.Black, null);

            DrawBrush(surface);

            surface.Print(1, 20, "New image width:");
            surface.Print(20, 20, newImageWidth.ToString());

            surface.Print(1, 22, "New image height:");
            surface.Print(20, 22, newImageHeight.ToString());
        }
Example #11
0
        public static void PrintStyledText(this CellSurface surface, int x, int y, params ColoredString[] text)
        {
            var glyphs        = text.SelectMany(part => part.ToArray()).ToArray();
            var coloredString = new ColoredString(glyphs);

            surface.Print(x, y, coloredString);
        }
Example #12
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            var labelX = Width / 2 - 7;

            surface.Print(labelX, 12, new ColoredString("You have died!", Color.Red, DefaultBackground));
        }
Example #13
0
 public static void DrawVerticalLine(this CellSurface surface, int x, int y, int length,
                                     ColoredGlyph coloredGlyph)
 {
     for (var dY = 0; dY < length; dY++)
     {
         surface.Print(x, y + dY, coloredGlyph);
     }
 }
Example #14
0
        /// <inheritdoc />
        public override void Draw(ControlsConsole console, CellSurface hostSurface)
        {
            hostSurface.DefaultForeground = FillStyle.Foreground;
            hostSurface.DefaultBackground = FillStyle.Background;
            hostSurface.Fill(hostSurface.DefaultForeground, hostSurface.DefaultBackground, FillStyle.Glyph, null);

            if (!(console is Window window))
            {
                return;
            }

            if (BorderLineStyle != null)
            {
                hostSurface.DrawBox(new Rectangle(0, 0, hostSurface.Width, hostSurface.Height), new Cell(BorderStyle.Foreground,
                                                                                                         BorderStyle.Background, 0), null, BorderLineStyle);
            }

            // Draw title
            var adjustedText  = "";
            var adjustedWidth = hostSurface.Width - 2;

            TitleAreaLength = 0;
            TitleAreaX      = 0;

            if (!string.IsNullOrEmpty(window.Title))
            {
                if (window.Title.Length > adjustedWidth)
                {
                    adjustedText = window.Title.Substring(0, window.Title.Length - (window.Title.Length - adjustedWidth));
                }
                else
                {
                    adjustedText = window.Title;
                }
            }

            if (!string.IsNullOrEmpty(adjustedText))
            {
                TitleAreaLength = adjustedText.Length;

                if (window.TitleAlignment == HorizontalAlignment.Left)
                {
                    TitleAreaX = 1;
                }

                else if (window.TitleAlignment == HorizontalAlignment.Center)
                {
                    TitleAreaX = ((adjustedWidth - adjustedText.Length) / 2) + 1;
                }

                else
                {
                    TitleAreaX = hostSurface.Width - 1 - adjustedText.Length;
                }

                hostSurface.Print(TitleAreaX, TitleAreaY, adjustedText, TitleStyle);
            }
        }
Example #15
0
        private void PrintStatStatus(int x, int y, PlayerStats stat, CellSurface surface)
        {
            int symbol = ' ';

            if (SelectedStat.HasValue && SelectedStat.Value == stat)
            {
                symbol = Glyphs.GetGlyph('▲');
            }
            surface.Print(x + maxStatNameLength + 5, y, new ColoredGlyph(symbol, TextHelper.PositiveValueColor.ToXna(), DefaultBackground));
        }
Example #16
0
        public void Draw(CellSurface surface, int y, int maxWidth, bool selected)
        {
            var backColor = selected ? SelectedItemBackColor : DefaultBackColor;

            surface.Fill(0, y, maxWidth, null, backColor, null);

            var indexText = BookIndex < 9 ? $"0{BookIndex + 1}" : $"{BookIndex + 1}";

            surface.Print(1, y, indexText, new Cell(SpellIndexColor, backColor));

            var spellName      = Spell?.Name ?? EmptySpellName;
            var spellNameColor = Spell == null ? EmptySpellNameColor : SpellNameColor;

            surface.Print(4, y, spellName, new Cell(spellNameColor, backColor));

            var manaCost = GetManaCostText();

            surface.Print(maxWidth - 5, y, manaCost, new Cell(TextHelper.ManaColor.ToXna(), backColor));
        }
Example #17
0
        private void PrintProtection(int dX, int dY, CellSurface surface)
        {
            surface.Print(dX, dY, "Protection:");

            var elements  = Enum.GetValues(typeof(Element)).Cast <Element>().ToArray();
            var maxLength = elements.Select(TextHelper.GetElementName).Select(name => name.Length).Max();

            for (var index = 0; index < elements.Length; index++)
            {
                var element = elements[index];

                var protection = Player.GetProtection(element);
                var color      = TextHelper.GetElementColor(element).ToXna();
                var name       = TextHelper.GetElementName(element);

                var y = dY + 2 + index;
                surface.Print(dX, y, name, color);
                surface.Print(dX + maxLength + 1, y, $"{protection}%");
            }
        }
Example #18
0
        public virtual void Draw(CellSurface surface, Rectangle area, object item, ControlStates itemState)
        {
            string value = item.ToString();

            if (value.Length < area.Width)
            {
                value += new string(' ', area.Width - value.Length);
            }
            else if (value.Length > area.Width)
            {
                value = value.Substring(0, area.Width);
            }
            if (Helpers.HasFlag(itemState, ControlStates.Selected) && !Helpers.HasFlag(itemState, ControlStates.MouseOver))
            {
                surface.Print(area.Left, area.Top, value, Selected);
            }
            else
            {
                surface.Print(area.Left, area.Top, value, GetStateAppearance(itemState));
            }
        }
Example #19
0
        private void PrintWeapon(int dX, int dY, CellSurface surface)
        {
            surface.Fill(1, dY, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('═'));
            surface.Print(0, dY, new ColoredGlyph(Glyphs.GetGlyph('╠'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, dY, new ColoredGlyph(Glyphs.GetGlyph('╣'), FrameColor, DefaultBackground));

            surface.PrintStyledText(dX, dY + 1, new StyledLine
            {
                "Right Hand: ",
                new StyledString(Player.Equipment.RightHandItem.Name, ItemDrawingHelper.GetItemColor(Player.Equipment.RightHandItem))
            }.ToColoredString(DefaultBackground));

            surface.Fill(1, dY + 2, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('─'));
            surface.Print(0, dY + 2, new ColoredGlyph(Glyphs.GetGlyph('╟'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, dY + 2, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));

            var rightWeaponDetails = GetHoldableDetails(Player.Equipment.RightHandItem);

            for (int yShift = 0; yShift < rightWeaponDetails.Length; yShift++)
            {
                var y = dY + 3 + yShift;
                surface.PrintStyledText(dX, y, rightWeaponDetails[yShift].ToColoredString(DefaultBackground));
            }

            var leftDy = dY + rightWeaponDetails.Length + 4;

            surface.Fill(1, leftDy, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('═'));
            surface.Print(0, leftDy, new ColoredGlyph(Glyphs.GetGlyph('╠'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, leftDy, new ColoredGlyph(Glyphs.GetGlyph('╣'), FrameColor, DefaultBackground));

            surface.PrintStyledText(dX, leftDy + 1, new StyledLine
            {
                "Left Hand:  ",
                new StyledString(Player.Equipment.LeftHandItem.Name, ItemDrawingHelper.GetItemColor(Player.Equipment.LeftHandItem))
            }.ToColoredString(DefaultBackground));

            surface.Fill(1, leftDy + 2, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('─'));
            surface.Print(0, leftDy + 2, new ColoredGlyph(Glyphs.GetGlyph('╟'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, leftDy + 2, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));

            var leftWeaponDetails = GetHoldableDetails(Player.Equipment.LeftHandItem);

            for (int yShift = 0; yShift < leftWeaponDetails.Length; yShift++)
            {
                var y = leftDy + 3 + yShift;
                surface.PrintStyledText(dX, y, leftWeaponDetails[yShift].ToColoredString(DefaultBackground));
            }
        }
Example #20
0
        public override void Draw(CellSurface surface, Rectangle area, object item, ControlStates itemState)
        {
            if (item is Color || item is Tuple <Color, Color, string> )
            {
                string value = new string(' ', area.Width - 2);

                Cell cellLook = GetStateAppearance(itemState).Clone();

                surface.Print(area.Left + 1, area.Top, value, cellLook);

                surface.Print(area.Left, area.Top, " ", cellLook);
                surface.Print(area.Left + area.Width - 1, area.Top, " ", cellLook);


                if (item is Color color)
                {
                    cellLook.Background = color;
                    surface.Print(area.Left + 1, area.Top, value, cellLook);
                }
                else
                {
                    cellLook.Foreground = ((Tuple <Color, Color, string>)item).Item2;
                    cellLook.Background = ((Tuple <Color, Color, string>)item).Item1;
                    value = ((Tuple <Color, Color, string>)item).Item3.Align(HorizontalAlignment.Left, area.Width - 2);
                    surface.Print(area.Left + 1, area.Top, value, cellLook);
                }

                if (itemState.HasFlag(ControlStates.Selected))
                {
                    surface.SetGlyph(area.Left, area.Top, 16);
                    surface.SetGlyph(area.Left + area.Width - 1, area.Top, 17);
                }
            }
            else
            {
                base.Draw(surface, area, item, itemState);
            }
        }
Example #21
0
        public void Draw(CellSurface surface, int y, int maxWidth, bool selected)
        {
            var backColor = selected ? SelectedItemBackColor : DefaultBackColor;

            surface.Fill(0, y, maxWidth, null, backColor, null);

            var text = GetNameText(selected, backColor);

            var afterNameText = new List <ColoredString>();

            if (Stack.TopItem is DurableItem durableItem)
            {
                var durabilityColor = TextHelper.GetDurabilityColor(durableItem.Durability, durableItem.MaxDurability);
                afterNameText.Add(new ColoredString(
                                      new ColoredGlyph(Glyphs.GetGlyph('•'), durabilityColor.ToXna(), backColor)));
            }
            afterNameText.AddRange(GetAfterNameText(backColor));
            var formattedText = FormatText(text, afterNameText.ToArray(), backColor, maxWidth - 1);

            surface.Print(1, y, formattedText);
            surface.PrintStyledText(1 + formattedText.Count, y, afterNameText.ToArray());
            surface.Print(maxWidth - 6, y, new ColoredString(GetWeightText(), WeightColor, backColor));
        }
Example #22
0
        public override void Draw(CellSurface surface, Rectangle area)
        {
            if (Item is Color || Item is Tuple <Color, Color, string> )
            {
                string value = new string(' ', area.Width - 2);

                CellAppearance cellLook = _currentAppearance.Clone();

                if (Item is Color)
                {
                    cellLook.Background = (Color)Item;
                    surface.Print(area.X + 1, area.Y, value, cellLook);
                }
                else
                {
                    cellLook.Foreground = ((Tuple <Color, Color, string>)Item).Item2;
                    cellLook.Background = ((Tuple <Color, Color, string>)Item).Item1;
                    value = ((Tuple <Color, Color, string>)Item).Item3.Align(HorizontalAlignment.Left, area.Width - 2);
                    surface.Print(area.X + 1, area.Y, value, cellLook);
                }

                surface.Print(area.X, area.Y, " ", _currentAppearance);
                surface.Print(area.X + area.Width - 1, area.Y, " ", _currentAppearance);

                if (IsSelected)
                {
                    surface.SetCharacter(area.X, area.Y, 16);
                    surface.SetCharacter(area.X + area.Width - 1, area.Y, 17);
                }

                IsDirty = false;
            }
            else
            {
                base.Draw(surface, area);
            }
        }
Example #23
0
        public virtual void Draw(CellSurface surface, Rectangle area)
        {
            string value = Item.ToString();

            if (value.Length < area.Width)
            {
                value += new string(' ', area.Width - value.Length);
            }
            else if (value.Length > area.Width)
            {
                value = value.Substring(0, area.Width);
            }

            surface.Print(area.X, area.Y, value, _currentAppearance);
            _isDirty = false;
        }
Example #24
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(2, 1, InventoryName);

            surface.Fill(1, 2, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('─'));
            surface.Print(0, 2, new ColoredGlyph(Glyphs.GetGlyph('╟'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, 2, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));

            surface.Print(Width - 54, 2, new ColoredGlyph(Glyphs.GetGlyph('┬'), FrameColor, DefaultBackground));
            surface.Print(Width - 54, Height - 1, new ColoredGlyph(Glyphs.GetGlyph('╧'), FrameColor, DefaultBackground));
            surface.DrawVerticalLine(Width - 54, 3, Height - 4, new ColoredGlyph(Glyphs.GetGlyph('│'), FrameColor, DefaultBackground));

            surface.Print(Width - 54, 4, new ColoredGlyph(Glyphs.GetGlyph('├'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, 4, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));
        }
Example #25
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(2, 1, "Spell Book:");
            surface.Print(14, 1, new ColoredString(SpellBook.Name, ItemDrawingHelper.GetItemColor(SpellBook).ToXna(), DefaultBackground));

            surface.Fill(1, 2, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('─'));
            surface.Print(0, 2, new ColoredGlyph(Glyphs.GetGlyph('╟'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, 2, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));

            surface.Print(Width - 59, 2, new ColoredGlyph(Glyphs.GetGlyph('┬'), FrameColor, DefaultBackground));
            surface.Print(Width - 59, Height - 1, new ColoredGlyph(Glyphs.GetGlyph('╧'), FrameColor, DefaultBackground));
            surface.DrawVerticalLine(Width - 59, 3, Height - 4, new ColoredGlyph(Glyphs.GetGlyph('│'), FrameColor, DefaultBackground));

            if (spellDetails.IsVisible)
            {
                surface.Print(Width - 59, 4, new ColoredGlyph(Glyphs.GetGlyph('├'), FrameColor, DefaultBackground));
                surface.Print(Width - 1, 4, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));
            }
        }
Example #26
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(2, 3, "Filter:");

            surface.Print(2, 1, "Spells Library");

            surface.Fill(1, 2, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('─'));
            surface.Print(0, 2, new ColoredGlyph(Glyphs.GetGlyph('╟'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, 2, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));

            surface.Print(Width - 59, 2, new ColoredGlyph(Glyphs.GetGlyph('┬'), FrameColor, DefaultBackground));
            surface.Print(Width - 59, Height - 1, new ColoredGlyph(Glyphs.GetGlyph('╧'), FrameColor, DefaultBackground));
            surface.DrawVerticalLine(Width - 59, 3, Height - 4, new ColoredGlyph(Glyphs.GetGlyph('│'), FrameColor, DefaultBackground));

            if (spellDetails.IsVisible)
            {
                surface.Print(Width - 59, 4, new ColoredGlyph(Glyphs.GetGlyph('├'), FrameColor, DefaultBackground));
                surface.Print(Width - 1, 4, new ColoredGlyph(Glyphs.GetGlyph('╢'), FrameColor, DefaultBackground));
            }
        }
        private void DrawStats(CellSurface surface)
        {
            surface.Print(2, 1, "Player Status");
            surface.Fill(1, 2, Width - 1, FrameColor, BackgroundColor, Glyphs.GetGlyph('─'));
            surface.DrawVerticalLine(0, 0, Height,
                                     new ColoredGlyph(Glyphs.GetGlyph('│'), FrameColor, BackgroundColor));
            surface.Print(0, 2, new ColoredGlyph(Glyphs.GetGlyph('├'), FrameColor, BackgroundColor));

            surface.Print(2, 3, $"Health [{game.Player.Health} / {game.Player.MaxHealth}]");

            surface.Print(2, 6, $"Mana [{game.Player.Mana} / {game.Player.MaxMana}]");

            surface.Print(2, 9, $"Stamina [{game.Player.Stamina} / {game.Player.MaxStamina}]");

            surface.Print(2, 12, $"Hunger [{game.Player.HungerPercent}%]");
        }
Example #28
0
        private void DrawFrame(CellSurface surface)
        {
            surface.Fill(DefaultForeground, DefaultBackground, null);

            surface.Fill(1, 0, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('═'));
            surface.Fill(1, Height - 1, Width - 2, FrameColor, DefaultBackground, Glyphs.GetGlyph('═'));
            surface.Print(0, 0, new ColoredGlyph(Glyphs.GetGlyph('╔'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, 0, new ColoredGlyph(Glyphs.GetGlyph('╗'), FrameColor, DefaultBackground));

            surface.Print(0, Height - 1, new ColoredGlyph(Glyphs.GetGlyph('╚'), FrameColor, DefaultBackground));
            surface.Print(Width - 1, Height - 1, new ColoredGlyph(Glyphs.GetGlyph('╝'), FrameColor, DefaultBackground));

            for (var y = 1; y < Height - 1; y++)
            {
                surface.Print(0, y, new ColoredGlyph(Glyphs.GetGlyph('║'), FrameColor, DefaultBackground));
                surface.Print(Width - 1, y, new ColoredGlyph(Glyphs.GetGlyph('║'), FrameColor, DefaultBackground));
            }
        }
Example #29
0
        protected override void DrawView(CellSurface surface)
        {
            base.DrawView(surface);

            surface.Print(5, 5, Message);
        }
Example #30
0
        private void DrawBrush(CellSurface surface)
        {
            const int dX = 4;
            const int dY = 2;

            surface.Print(1, dY, "Brush:");
            surface.Print(dX, dY + 1, "Symbol: ");
            if (brush.Symbol.HasValue)
            {
                surface.Fill(dX + 8, dY + 1, 5, Color.White, Color.Black, ' ');
                surface.Print(dX + 8, dY + 1, new ColoredGlyph(brush.Symbol.Value));
                surface.Print(dX + 10, dY + 1, brush.Symbol.ToString());
            }
            else
            {
                surface.Fill(dX + 8, dY + 1, 5, Color.White, Color.Black, ' ');
                surface.Print(dX + 8, dY + 1, "null");
            }

            surface.Print(dX, dY + 2, "Fore: ");
            if (brush.ForeColor.HasValue)
            {
                surface.Fill(dX + 6, dY + 2, 5, Color.White, Color.Black, ' ');
                surface.Print(dX + 6, dY + 2, new ColoredGlyph(' ', Color.White, brush.ForeColor.Value.ToXna()));
            }
            else
            {
                surface.Fill(dX + 6, dY + 2, 5, Color.White, Color.Black, ' ');
                surface.Print(dX + 6, dY + 2, "null");
            }

            surface.Print(dX, dY + 3, "Back: ");
            if (brush.BackColor.HasValue)
            {
                surface.Fill(dX + 6, dY + 3, 5, Color.White, Color.Black, ' ');
                surface.Print(dX + 6, dY + 3, new ColoredGlyph(' ', Color.White, brush.BackColor.Value.ToXna()));
            }
            else
            {
                surface.Fill(dX + 6, dY + 3, 5, Color.White, Color.Black, ' ');
                surface.Print(dX + 6, dY + 3, "null");
            }
        }