コード例 #1
0
        // ## PUBLIC METHODS ##

        // draws the spit at the given coordinates
        public void Draw(int x, int y)
        {
            // sets data of the 3 buffers at provided coords with spit data
            ConsoleRenderer.SetChar(x, y, character);
            ConsoleRenderer.SetColor(x, y, foregroundColor);
            ConsoleRenderer.SetColor(x, y, backgroundColor);
        }
コード例 #2
0
        // ## PRIVATE UTITLITY METHODS ## // Things to make drawing easier

        // draws a string with left formatting at the given position
        private static void _drawString(Coord pos, string s, Color.Foreground fg, Color.Background bg)
        {
            // Exits if y is out of range
            if (!(0 <= pos.y && pos.y < ConsoleRenderer.Height))
            {
                return;
            }

            int x = pos.x;

            foreach (char c in s)
            {
                if (ConsoleRenderer.Width <= x)
                {
                    break;
                }
                ConsoleRenderer.SetChar(x, pos.y, c);
                ConsoleRenderer.SetColor(x, pos.y, fg);
                ConsoleRenderer.SetColor(x, pos.y, bg);
                x++;
            }
        }