Example #1
0
 public CharData(MTexture texture, XmlElement xml)
 {
     Texture  = texture.GetSubtexture(xml.AttrInt("x"), xml.AttrInt("y"), xml.AttrInt("width"), xml.AttrInt("height"));
     XOffset  = xml.AttrInt("xoffset");
     YOffset  = xml.AttrInt("yoffset");
     XAdvance = xml.AttrInt("xadvance");
 }
Example #2
0
 public PixelFontCharacter(int character, MTexture texture, XmlElement xml)
 {
     Character = character;
     Texture   = texture.GetSubtexture(xml.AttrInt("x"), xml.AttrInt("y"), xml.AttrInt("width"), xml.AttrInt("height"));
     XOffset   = xml.AttrInt("xoffset");
     YOffset   = xml.AttrInt("yoffset");
     XAdvance  = xml.AttrInt("xadvance");
 }
        public void SetFrames(MTexture texture, int frameWidth, int frameHeight, int frameSep = 0)
        {
            List <MTexture> frames = new List <MTexture>();
            int             x = 0, y = 0;

            while (y <= texture.Height - frameHeight)
            {
                while (x <= texture.Width - frameWidth)
                {
                    frames.Add(texture.GetSubtexture(x, y, frameWidth, frameHeight));
                    x += frameWidth + frameSep;
                }

                y += frameHeight + frameSep;
                x  = 0;
            }

            Frames = frames.ToArray();
        }