Ejemplo n.º 1
0
            static void ReadChars(
                BinaryReader reader,
                BitmapFont font,
                List <Texture> textures,
                int blockSize)
            {
                var count = blockSize / 20;

                for (int i = 0; i < count; i++)
                {
                    var ascii  = reader.ReadInt32();
                    var bounds = new Rectangle(
                        reader.ReadInt16(),
                        reader.ReadInt16(),
                        reader.ReadInt16(),
                        reader.ReadInt16());
                    var offset = new Point(
                        reader.ReadInt16(),
                        reader.ReadInt16());
                    var spacing = reader.ReadInt16();
                    var page    = (int)reader.ReadByte();
                    var texture = textures[page].ClipRegion(bounds);

                    var character = new BitmapCharacter(texture, ascii, offset, spacing);
                    font.Characters.Add((char)ascii, character);
                    reader.ReadByte();
                }
            }
Ejemplo n.º 2
0
            static void ReadChars(XmlElement root, BitmapFont font, List <Texture> textures)
            {
                var chars = root["chars"];

                foreach (XmlElement charInfo in chars)
                {
                    var ascii   = charInfo.AttrToInt32("id");
                    var bounds  = charInfo.AttrToRectangle();
                    var offset  = charInfo.AttrToPoint("xoffset", "yoffset");
                    var spacing = charInfo.AttrToInt32("xadvance");
                    var page    = charInfo.AttrToInt32("page");
                    var texture = textures[page].ClipRegion(bounds);

                    var character = new BitmapCharacter(texture, ascii, offset, spacing);
                    font.Characters.Add(ascii, character);
                }
            }
Ejemplo n.º 3
0
 internal SpriteTextCharacter(BitmapCharacter source, Vector2 offset)
 {
     Source = source;
     Offset = offset;
 }