Exemple #1
0
		public SpriteRegion CreateSpriteRegion(string name) {
			this.Pack();
			PackEntry entry = GetEntry(name);
			if (entry == null) {
				return null;
			}
			SpriteRegion region = new SpriteRegion(texture, entry.bounds.left,
					entry.bounds.top, entry.bounds.right, entry.bounds.bottom);
			return region;
		}
Exemple #2
0
 public void Set(SpriteRegion sprite)
 {
     if (sprite == null)
     {
         throw new ArgumentException("sprite cannot be null.");
     }
     texture     = sprite.texture;
     xOff        = sprite.xOff;
     yOff        = sprite.yOff;
     widthRatio  = sprite.widthRatio;
     heightRatio = sprite.heightRatio;
     x           = sprite.x;
     y           = sprite.y;
     width       = sprite.width;
     height      = sprite.height;
     originX     = sprite.originX;
     originY     = sprite.originY;
     rotation    = sprite.rotation;
     scaleX      = sprite.scaleX;
     scaleY      = sprite.scaleY;
     SetColor(sprite.color);
     dirty = sprite.dirty;
 }
Exemple #3
0
 public void set(SpriteRegion sprite)
 {
     if (sprite == null)
     {
         throw new Exception("sprite cannot be null.");
     }
     Array.Copy(sprite.vertices, 0, vertices, 0, 4);
     texture     = sprite.texture;
     xOff        = sprite.xOff;
     yOff        = sprite.yOff;
     widthRatio  = sprite.widthRatio;
     heightRatio = sprite.heightRatio;
     x           = sprite.x;
     y           = sprite.y;
     width       = sprite.width;
     height      = sprite.height;
     originX     = sprite.originX;
     originY     = sprite.originY;
     rotation    = sprite.rotation;
     scaleX      = sprite.scaleX;
     scaleY      = sprite.scaleY;
     color.SetColor(sprite.color);
     dirty = sprite.dirty;
 }
 public SpriteRegion(SpriteRegion sprite)
 {
     Set(sprite);
 }
 public void Set(SpriteRegion sprite)
 {
     if (sprite == null)
     {
         throw new ArgumentException("sprite cannot be null.");
     }
     texture = sprite.texture;
     xOff = sprite.xOff;
     yOff = sprite.yOff;
     widthRatio = sprite.widthRatio;
     heightRatio = sprite.heightRatio;
     x = sprite.x;
     y = sprite.y;
     width = sprite.width;
     height = sprite.height;
     originX = sprite.originX;
     originY = sprite.originY;
     rotation = sprite.rotation;
     scaleX = sprite.scaleX;
     scaleY = sprite.scaleY;
     SetColor(sprite.color);
     dirty = sprite.dirty;
 }
Exemple #6
0
 public void set(SpriteRegion sprite)
 {
     if (sprite == null)
     {
         throw new Exception("sprite cannot be null.");
     }
     Array.Copy(sprite.vertices, 0, vertices, 0, 4);
     texture = sprite.texture;
     xOff = sprite.xOff;
     yOff = sprite.yOff;
     widthRatio = sprite.widthRatio;
     heightRatio = sprite.heightRatio;
     x = sprite.x;
     y = sprite.y;
     width = sprite.width;
     height = sprite.height;
     originX = sprite.originX;
     originY = sprite.originY;
     rotation = sprite.rotation;
     scaleX = sprite.scaleX;
     scaleY = sprite.scaleY;
     color.SetColor(sprite.color);
     dirty = sprite.dirty;
 }
Exemple #7
0
        public void DrawSpriteBounds(SpriteRegion sprite, LColor color)
        {
            VertexPositionColorTexture[] vertices = sprite.getVertices();

            float x1 = vertices[0].Position.X;
            float y1 = vertices[0].Position.Y;

            float x2 = vertices[1].Position.X;
            float y2 = vertices[1].Position.Y;

            float x3 = vertices[2].Position.X;
            float y3 = vertices[2].Position.Y;

            float x4 = vertices[3].Position.X;
            float y4 = vertices[3].Position.Y;

            Submit();
            GLEx gl = GLEx.Self;
            LColor old = gl.GetColor();
            gl.SetColor(color);
            gl.DrawLine(x1, y1, x2, y2);
            gl.DrawLine(x2, y2, x3, y3);
            gl.DrawLine(x3, y3, x4, y4);
            gl.DrawLine(x4, y4, x1, y1);
            gl.SetColor(old);
        }
Exemple #8
0
 public SpriteRegion(SpriteRegion sprite)
 {
     set(sprite);
 }