tiles.rc: impl TileSpec class for reading tile specification
and rewrite MakeTiles to use the TileSpec class git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@727 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
parent
8793847415
commit
153e0e48f5
2 changed files with 176 additions and 5 deletions
|
@ -35,10 +35,11 @@ public class MakeTiles
|
|||
Graphics2D gr = buf.createGraphics();
|
||||
|
||||
for (int i = 0; i < NTILES; i++) {
|
||||
String tileImage = recipe.getProperty(Integer.toString(i));
|
||||
assert tileImage != null;
|
||||
String rawSpec = recipe.getProperty(Integer.toString(i));
|
||||
assert rawSpec != null;
|
||||
|
||||
ImageSpec ref = parseImageSpec(tileImage);
|
||||
TileSpec tileSpec = TileSpec.parse(rawSpec);
|
||||
ImageSpec ref = parseImageSpec(tileSpec);
|
||||
drawTo(ref, gr, 0, TILE_SIZE*i);
|
||||
}
|
||||
|
||||
|
@ -81,12 +82,13 @@ public class MakeTiles
|
|||
int height;
|
||||
}
|
||||
|
||||
static ImageSpec parseImageSpec(String chain)
|
||||
static ImageSpec parseImageSpec(TileSpec spec)
|
||||
{
|
||||
ImageSpec result = null;
|
||||
|
||||
for (String layerStr : chain.split("\\s*\\|")) {
|
||||
for (String layerStr : spec.getValues("image")) {
|
||||
|
||||
System.err.println("parsing "+layerStr);
|
||||
ImageSpec rv = new ImageSpec();
|
||||
rv.background = result;
|
||||
result = rv;
|
||||
|
|
Reference in a new issue