コード例 #1
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
        public static void Blit(char[,] inBuffer, int x, int y, AdvConsoleColor foreColor = AdvConsoleColor.None, AdvConsoleColor backColor = AdvConsoleColor.None)
        {
            int width = inBuffer.GetLength(1);
            int height = inBuffer.GetLength(0);

            for (int ly = 0; ly < height; ly++)
            {
                for (int lx = 0; lx < width; lx++)
                {
                    if ((x + lx) > consoleWidth - 1 || (y + ly) > consoleHeight - 1)
                        continue;

                    int bufferIndex = ((x + lx) + ((y * consoleWidth) + (ly * consoleWidth)));

                    if (bufferIndex >= 0 && bufferIndex < backBuffer.Length)
                    {
                        SetCharacter(bufferIndex, inBuffer[ly, lx], foreColor, backColor);
                    }
                }
            }
        }
コード例 #2
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
        public static void WriteList(string[] text, int x, int y, bool horizontal, AdvConsoleColor foreColor, AdvConsoleColor backColor)
        {
            int lineX = x;
            int lineY = y;

            //int lastLineLength = 0;

            for (int s = 0; s < (text.Length); s++)
            {
                char[,] line = ConstructStringBuffer(text[s]);

                Blit(line, lineX, lineY, foreColor, backColor);

                if (horizontal)
                    lineX += text[s].Length;
                else
                    lineY += 1 + line.GetUpperBound(0);
            }
        }
コード例 #3
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void Blit(char[,] inBuffer, Point position, AdvConsoleColor foreColor, AdvConsoleColor backColor)
 {
     Blit(inBuffer, position.X, position.Y, foreColor, backColor);
 }
コード例 #4
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void Write(string text, int x, int y, AdvConsoleColor foreColor, AdvConsoleColor backColor = AdvConsoleColor.None)
 {
     Blit(ConstructStringBuffer(text), x, y, foreColor, backColor);
 }
コード例 #5
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void WriteList(string[] text, Point position, bool horizontal, AdvConsoleColor foreColor, AdvConsoleColor backColor)
 {
     WriteList(text, position.X, position.Y, horizontal, foreColor, backColor);
 }
コード例 #6
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
        /// <summary>
        /// Sets the info for a character at the specified index in the buffer
        /// </summary>
        /// <param name="index">Index of the buffer</param>
        /// <param name="character">Character to write</param>
        /// <param name="foreColor">Foreground Color</param>
        /// <param name="backColor">Background Color</param>
        public static void SetCharacter(int index, char character, AdvConsoleColor foreColor, AdvConsoleColor backColor)
        {
            backBuffer[index].Char.UnicodeChar = character;

            byte foreCol = (byte)foreColor;
            byte backCol = (byte)backColor;

            if (backColor == AdvConsoleColor.None)
            {
                byte fc = (byte)(backBuffer[index].Attributes % 16);
                backCol = (byte)((backBuffer[index].Attributes - fc) / 16);
            }

            if (foreColor == AdvConsoleColor.None)
            {
                foreCol = (byte)(backBuffer[index].Attributes % 16);
            }

            backBuffer[index].Attributes = (byte)((byte)(foreCol) + (byte)((int)backCol * 16));
        }
コード例 #7
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void Write(string text, Point position, AdvConsoleColor foreColor, AdvConsoleColor backColor = AdvConsoleColor.None)
 {
     Write(text, position.X, position.Y, foreColor, backColor);
 }
コード例 #8
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void Outline(Rectangle area, char topCharacter, char sideCharacter, char topLeftCharacter, char topRightCharacter, char bottomLeftCharacter, char bottomRightCharacter, AdvConsoleColor foreColor, AdvConsoleColor backColor = AdvConsoleColor.None)
 {
     Outline(area.X, area.Y, area.Width, area.Height, topCharacter, sideCharacter, topLeftCharacter, topRightCharacter, bottomLeftCharacter, bottomRightCharacter, foreColor, backColor);
 }
コード例 #9
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
        public static void Outline(int x, int y, int width, int height, char topCharacter, char sideCharacter, char topLeftCharacter, char topRightCharacter, char bottomLeftCharacter, char bottomRightCharacter, AdvConsoleColor foreColor, AdvConsoleColor backColor = AdvConsoleColor.None)
        {
            for (int ly = 0; ly < height; ly++)
            {
                for (int lx = 0; lx < width; lx++)
                {
                    if ((lx > 0 && lx < (width - 1)) && (ly > 0 && ly < (height - 1)))
                        continue;

                    int bufferIndex = ((x + lx) + ((y * consoleWidth) + (ly * consoleWidth)));

                    if (bufferIndex < backBuffer.Length)
                    {
                        if (ly <= 0 || ly >= (height - 1))
                        {
                            char character;
                            if (lx >= (width - 1) && ly <= 0)
                                character = topRightCharacter;
                            else if (lx >= (width - 1) && ly >= (height - 1))
                                character = bottomRightCharacter;
                            else if (lx <= 0 && ly <= 0)
                                character = topLeftCharacter;
                            else if (lx <= 0 && ly >= (height - 1))
                                character = bottomLeftCharacter;
                            else
                                character = topCharacter;

                            SetCharacter(bufferIndex, character, foreColor, backColor);
                        }
                        else if  (lx <= 0 || lx >= (width - 1))
                        {
                            SetCharacter(bufferIndex, sideCharacter, foreColor, backColor);
                        }
                    }
                }
            }
        }
コード例 #10
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void Outline(int x, int y, int width, int height, char topCharacter, char sideCharacter, AdvConsoleColor foreColor, AdvConsoleColor backColor = AdvConsoleColor.None)
 {
     Outline(x, y, width, height, topCharacter, sideCharacter, topCharacter, sideCharacter, topCharacter, sideCharacter, foreColor, backColor);
 }
コード例 #11
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void Outline(Rectangle area, char character, AdvConsoleColor foreColor, AdvConsoleColor backColor = AdvConsoleColor.None)
 {
     Outline(area.X, area.Y, area.Width, area.Height, character, foreColor, backColor);
 }
コード例 #12
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
        public static void Fill(int x, int y, int width, int height, char character, AdvConsoleColor foreColor = AdvConsoleColor.None, AdvConsoleColor backColor = AdvConsoleColor.None)
        {
            for (int ly = 0; ly < height; ly++)
            {
                for (int lx = 0; lx < width; lx++)
                {
                    int bufferIndex = ((x + lx) + ((y * consoleWidth) + (ly * consoleWidth)));

                    if (bufferIndex < backBuffer.Length)
                    {
                        SetCharacter(bufferIndex, character, foreColor, backColor);
                    }
                }
            }
        }
コード例 #13
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 public static void Fill(Rectangle area, char character, AdvConsoleColor foreColor, AdvConsoleColor backColor)
 {
     Fill(area.X, area.Y, area.Width, area.Height, character, foreColor, backColor);
 }
コード例 #14
0
ファイル: AdvConsole.cs プロジェクト: rvIceBreaker/aclib
 /// <summary>
 /// Removes text from the entire screen and sets the background color
 /// </summary>
 /// <param name="backColor">Background Color</param>
 public static void ClearScreen(AdvConsoleColor backColor)
 {
     for (int i = 0; i < backBuffer.Count(); i++)
     {
         backBuffer[i].Char.UnicodeChar = ('\0');
         backBuffer[i].Attributes = (byte)((int)backColor * 16);
     }
 }