void OutputLines(IDrawer2D drawer, string[] lines, int *lineLens, int usedLines, int charsPerLine)
        {
            int totalChars = charsPerLine * lines.Length;

            for (int i = 0; i < totalChars; i++)
            {
                if (value[i] == '\0')
                {
                    value[i] = ' ';
                }
            }
            // convert %0-f to &0-f for colour preview.
            for (int i = 0; i < totalChars - 1; i++)
            {
                if (value[i] == '%' && drawer.ValidColour(value[i + 1]))
                {
                    value[i] = '&';
                }
            }

            usedLines = Math.Max(1, usedLines);
            for (int i = 0; i < usedLines; i++)
            {
                lines[i] = new String(value, i * charsPerLine, lineLens[i]);
            }
        }
Beispiel #2
0
        void CalculateCaretCol()
        {
            int       x      = indexX;
            IDrawer2D drawer = game.Drawer2D;

            for (int y = indexY; y >= 0; y--)
            {
                string part = parts[y];
                if (x == partLens[y])
                {
                    x = partLens[y] - 1;
                }
                int  start      = part.LastIndexOf('&', x, x + 1);
                bool validIndex = start >= 0 && start < partLens[y] - 1;

                if (validIndex && drawer.ValidColour(part[start + 1]))
                {
                    caretCol = drawer.Colours[part[start + 1]]; return;
                }
                if (y > 0)
                {
                    x = partLens[y - 1] - 1;
                }
            }
        }
Beispiel #3
0
        void OutputLines(IDrawer2D drawer, ref string[] lines, int linesCount, int lineSize, int[] lineLens)
        {
            for (int i = 0; i < capacity; i++)
            {
                if (value[i] == '\0')
                {
                    value[i] = ' ';
                }
            }
            // convert %0-f to &0-f for colour preview.
            for (int i = 0; i < capacity - 1; i++)
            {
                if (value[i] == '%' && drawer.ValidColour(value[i + 1]))
                {
                    value[i] = '&';
                }
            }

            for (int i = 0; i < Math.Max(1, linesCount); i++)
            {
                lines[i] = new String(value, i * lineSize, lineLens[i]);
            }
        }
        void OutputLines( IDrawer2D drawer, ref string[] lines, int[] lineLens, 
            int linesCount, int lineSize, int totalChars)
        {
            for( int i = 0; i < totalChars; i++ ) {
                if( value[i] == '\0' ) value[i] = ' ';
            }
            // convert %0-f to &0-f for colour preview.
            for( int i = 0; i < totalChars - 1; i++ ) {
                if( value[i] == '%' && drawer.ValidColour( value[i + 1] ) )
                    value[i] = '&';
            }

            for( int i = 0; i < Math.Max( 1, linesCount ); i++ )
                lines[i] = new String( value, i * lineSize, lineLens[i] );
        }