Esempio n. 1
0
        public void Process(ResourceID id)
        {
            reader = Burntime.Platform.IO.FileSystem.GetFile(id.File).GetSubFile(0, -1);

            charInfo = new Dictionary <char, CharInfo>();

            chars = new CharInfo[98];
            for (int i = 0; i < 98; i++)
            {
                chars[i].pos   = reader.ReadUShort();
                chars[i].width = reader.ReadUShort();

                charInfo.Add((char)(' ' + i), chars[i]);
            }

            for (int i = 0; i < 98; i++)
            {
                reader.Seek(chars[i].pos, Burntime.Platform.IO.SeekPosition.Begin);

                int unknown1 = reader.ReadUShort();
                int unknown2 = reader.ReadUShort();

                chars[i].imgWidth  = 4 * (unknown1 + 1);
                chars[i].imgHeight = unknown2;
            }
        }
Esempio n. 2
0
        int DrawChar(ByteBuffer input, char ch, int offsetx, int offsety, PixelColor fore, PixelColor back)
        {
            CharInfo info = chars[translateChar(ch)];

            reader.Seek(info.pos, Burntime.Platform.IO.SeekPosition.Begin);

            int w     = 1;
            int h     = 8;
            int round = 0;
            int pos   = 0;

            int unknown1 = reader.ReadUShort();
            int unknown2 = reader.ReadUShort();

            w = 4 * (unknown1 + 1);
            h = unknown2;

            while (!reader.IsEOF && round != 4)
            {
                int data = reader.ReadByte();

                PixelColor c;
                if (back != PixelColor.Black)
                {
                    c = (data == 0x01) ? back : fore;
                }
                else
                {
                    c = (data == 0x01) ? PixelColor.Black : PixelColor.White;
                }

                int x = pos % w;
                int y = (pos - x) / w;

                if (data != 0)
                {
                    input.DrawPixel(x + offsetx, y + offsety, c.r, c.g, c.b);
                }

                pos += 4;
                if (pos >= w * h)
                {
                    pos -= w * h;
                    pos++;
                    round++;
                }
            }

            return(info.width);
        }