Пример #1
0
        private void DrawTextsInternal()
        {
            _ox = 0;
            _oy = TextOffset - CharSize;
            _context.SymbolRenderer.Palette = FF8TextTagColor.White;
            _line      = -1;
            _charIndex = 0;
            _charsLeft = _text.Length;

            NewLine();
            while (_charsLeft > 0)
            {
                CheckNewLines();
                if (_oy >= ScreenHeight)
                {
                    break;
                }

                FF8TextTag tag = FF8TextTag.TryRead(_text, ref _charIndex, ref _charsLeft);
                if (tag != null)
                {
                    DrawTag(tag);
                }
                else if (FF8TextComment.TryRead(_text, ref _charIndex, ref _charsLeft) == null)
                {
                    DrawChar(_text[_charIndex++]);
                    _charsLeft--;
                }

                if (_ox >= ScreenWidth)
                {
                    SkipLine();
                }
            }

            _oy += CharSize;
            if (_oy > _context.MaxHeight)
            {
                _context.MaxHeight = _oy;
            }
        }
Пример #2
0
        public Int32 GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex)
        {
            Int32 result = 0;

            while (charCount > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(chars, ref charIndex, ref charCount);
                if (tag != null)
                {
                    result += tag.Write(bytes, ref byteIndex);
                }
                else if (FF8TextComment.TryRead(chars, ref charIndex, ref charCount) == null)
                {
                    bytes[byteIndex++] = _codepage[chars[charIndex++]];
                    charCount--;
                    result++;
                }
            }

            return(result);
        }
Пример #3
0
        public int GetChars(byte[] bytes, int byteIndex, int byteCount, char[] chars, int charIndex)
        {
            int result = 0;

            while (byteCount > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(bytes, ref byteIndex, ref byteCount);
                if (tag != null)
                {
                    result += tag.Write(chars, ref charIndex);
                }
                else
                {
                    chars[charIndex++] = _codepage[bytes[byteIndex++]];
                    byteCount--;
                    result++;
                }
            }

            return(result);
        }
Пример #4
0
        public int GetBytes(char[] chars, int charIndex, int charCount, byte[] bytes, int byteIndex)
        {
            var result = 0;

            while (charCount > 0)
            {
                var tag = FF8TextTag.TryRead(chars, ref charIndex, ref charCount);
                if (tag != null)
                {
                    result += tag.Write(bytes, ref byteIndex);
                }
                else if (FF8TextComment.TryRead(chars, ref charIndex, ref charCount) == null)
                {
                    bytes[byteIndex++] = _codepage[chars[charIndex++]];
                    charCount--;
                    result++;
                }
            }

            return(result);
        }
Пример #5
0
        public Int32 GetByteCount(Char[] chars, Int32 index, Int32 count)
        {
            Int32 result = 0;

            Byte[] buff = new Byte[2];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(chars, ref index, ref count);
                if (tag != null)
                {
                    Int32 offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else if (FF8TextComment.TryRead(chars, ref index, ref count) == null)
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }
Пример #6
0
        public int GetCharCount(byte[] bytes, int index, int count)
        {
            int result = 0;

            char[] buff = new char[FF8TextTag.MaxTagLength];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(bytes, ref index, ref count);
                if (tag != null)
                {
                    int offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }
Пример #7
0
        public Int32 GetCharCount(Byte[] bytes, Int32 index, Int32 count)
        {
            Int32 result = 0;

            Char[] buff = new Char[FF8TextTag.MaxTagLength];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(bytes, ref index, ref count);
                if (tag != null)
                {
                    Int32 offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }
Пример #8
0
        public int GetByteCount(char[] chars, int index, int count)
        {
            int result = 0;

            byte[] buff = new byte[2];
            while (count > 0)
            {
                FF8TextTag tag = FF8TextTag.TryRead(chars, ref index, ref count);
                if (tag != null)
                {
                    int offset = 0;
                    result += tag.Write(buff, ref offset);
                }
                else if (FF8TextComment.TryRead(chars, ref index, ref count) == null)
                {
                    count--;
                    result++;
                    index++;
                }
            }

            return(result);
        }