OSDN Git Service

TextureAtlas, allow data to be null (simplifies using/not using data with a subclass...
authorNathanSweet <nathan.sweet@gmail.com>
Sun, 3 Feb 2013 11:37:02 +0000 (12:37 +0100)
committerNathanSweet <nathan.sweet@gmail.com>
Sun, 3 Feb 2013 11:37:02 +0000 (12:37 +0100)
gdx/src/com/badlogic/gdx/graphics/g2d/TextureAtlas.java

index 1e5d5bf..f12fae1 100644 (file)
@@ -222,8 +222,9 @@ public class TextureAtlas implements Disposable {
                this(new TextureAtlasData(packFile, imagesDir, flip));\r
        }\r
 \r
+       /** @param data May be null. */\r
        public TextureAtlas (TextureAtlasData data) {\r
-               load(data);\r
+               if (data != null) load(data);\r
        }\r
 \r
        private void load (TextureAtlasData data) {\r
@@ -488,6 +489,8 @@ public class TextureAtlas implements Disposable {
 \r
                public AtlasRegion (Texture texture, int x, int y, int width, int height) {\r
                        super(texture, x, y, width, height);\r
+                       originalWidth = width;\r
+                       originalHeight = height;\r
                        packedWidth = width;\r
                        packedHeight = height;\r
                }\r