OSDN Git Service

[fixed] issue 733, copy constructor of Sprite had a few issues.
authorbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sat, 3 Mar 2012 11:33:09 +0000 (11:33 +0000)
committerbadlogicgames <badlogicgames@6c4fd544-2939-11df-bb46-9574ba5d0bfa>
Sat, 3 Mar 2012 11:33:09 +0000 (11:33 +0000)
gdx/src/com/badlogic/gdx/graphics/g2d/Sprite.java

index c3372f5..33cb4a2 100644 (file)
@@ -36,7 +36,7 @@ public class Sprite extends TextureRegion {
        static final int VERTEX_SIZE = 2 + 1 + 2;\r
        static final int SPRITE_SIZE = 4 * VERTEX_SIZE;\r
 \r
-       final float[] vertices = new float[20];\r
+       final float[] vertices = new float[SPRITE_SIZE];\r
        private final Color color = new Color(1, 1, 1, 1);\r
        private float x, y;\r
        float width, height;\r
@@ -104,6 +104,10 @@ public class Sprite extends TextureRegion {
                if (sprite == null) throw new IllegalArgumentException("sprite cannot be null.");\r
                System.arraycopy(sprite.vertices, 0, vertices, 0, SPRITE_SIZE);\r
                texture = sprite.texture;\r
+               u = sprite.u;\r
+               v = sprite.v;\r
+               u2 = sprite.u2;\r
+               v2 = sprite.v2;\r
                x = sprite.x;\r
                y = sprite.y;\r
                width = sprite.width;\r
@@ -113,6 +117,7 @@ public class Sprite extends TextureRegion {
                rotation = sprite.rotation;\r
                scaleX = sprite.scaleX;\r
                scaleY = sprite.scaleY;\r
+               color.set(sprite.color);\r
                dirty = sprite.dirty;\r
        }\r
 \r