예제 #1
0
        public static void DrawCard(Card card, int x, int y, int height, int width = 0)
        {
            if (width <= 0)
            {
                width = GetCardWidth(height);
            }

            //ConsoleRenderer.FillRect(' ', x + 1, y + 1, width - 2, height - 2, CharAttribute.BackgroundBlack);

            Border border = new RoundedBorder();

            border.Width      = width;
            border.Height     = height;
            border.Left       = x;
            border.Top        = y;
            border.Attributes = CharAttribute.ForegroundWhite;
            border.Draw();

            var suit = suits[(int)card.Suit];
            var rank = ranks[(int)card.Rank];

            bool isRed = card.Suit == Suit.Diamonds || card.Suit == Suit.Hearts;

            //ConsoleRenderer.DrawChar(
            //    suit,
            //    x + width / 2,
            //    y + height / 2,
            //    isRed ?
            //    CharAttribute.ForegroundRed :
            //    CharAttribute.ForegroundWhite
            //);

            //ConsoleRenderer.DrawString(rank, x + 1, y + 1, CharAttribute.ForegroundWhite);
            //ConsoleRenderer.DrawString(rank, x + width - 1 - rank.Length, y + height - 2, CharAttribute.ForegroundWhite);
        }
예제 #2
0
        public static void DrawTable(int x, int y, int w, int h)
        {
            var border = new RoundedBorder();

            border.Width      = w;
            border.Height     = h;
            border.Left       = x;
            border.Top        = y;
            border.Attributes = CharAttribute.ForegroundWhite;
            border.Draw();
            var innerBorder = new DashedBorder();

            innerBorder.Width      = w - 2;
            innerBorder.Height     = h - 2;
            innerBorder.Left       = x + 1;
            innerBorder.Top        = y + 1;
            innerBorder.Attributes = CharAttribute.ForegroundWhite;
            innerBorder.Draw();
        }