Esempio n. 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;
            }
        }
Esempio n. 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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }