MakeTiles: refactor: load images at parse time

this will allow me to detect and load animations (in a future commit)
This commit is contained in:
Jason Long 2014-06-19 09:30:15 -04:00
parent cb84994ce8
commit d207232fea

View file

@ -116,7 +116,7 @@ public class MakeTiles
drawTo(ref.background, gr, destX, destY); drawTo(ref.background, gr, destX, destY);
} }
SourceImage sourceImg = loadImage(ref.fileName); SourceImage sourceImg = ref.image;
gr.drawImage( gr.drawImage(
sourceImg.image, sourceImg.image,
@ -143,12 +143,13 @@ public class MakeTiles
static class FrameSpec static class FrameSpec
{ {
FrameSpec background; FrameSpec background;
String fileName; SourceImage image;
int offsetX; int offsetX;
int offsetY; int offsetY;
} }
static FrameSpec parseFrameSpec(TileSpec spec) static FrameSpec parseFrameSpec(TileSpec spec)
throws IOException
{ {
FrameSpec result = null; FrameSpec result = null;
@ -159,7 +160,7 @@ public class MakeTiles
result = rv; result = rv;
String [] parts = layerStr.split("@", 2); String [] parts = layerStr.split("@", 2);
rv.fileName = parts[0]; rv.image = loadImage(parts[0]);
if (parts.length >= 2) { if (parts.length >= 2) {
String offsetInfo = parts[1]; String offsetInfo = parts[1];