MakeTiles: output to a graphics directory instead of a specific file
This commit is contained in:
parent
eb97e1c27c
commit
c0f1d6a486
2 changed files with 15 additions and 13 deletions
|
@ -48,25 +48,25 @@
|
|||
<java classname="micropolisj.build_tool.MakeTiles" classpath="${builddir}"
|
||||
fork="true" failonerror="true" dir="graphics" inputstring="">
|
||||
<arg file="graphics/tiles.rc" />
|
||||
<arg file="${builddir}/tiles.png" />
|
||||
<arg file="${builddir}/16x16" />
|
||||
</java>
|
||||
<java classname="micropolisj.build_tool.MakeTiles" classpath="${builddir}"
|
||||
fork="true" failonerror="true" dir="graphics" inputstring="">
|
||||
<sysproperty key="tile_size" value="8" />
|
||||
<arg file="graphics/tiles.rc" />
|
||||
<arg file="${builddir}/tiles_8x8.png" />
|
||||
<arg file="${builddir}/8x8" />
|
||||
</java>
|
||||
<java classname="micropolisj.build_tool.MakeTiles" classpath="${builddir}"
|
||||
fork="true" failonerror="true" dir="graphics" inputstring="">
|
||||
<sysproperty key="tile_size" value="32" />
|
||||
<arg file="graphics/tiles.rc" />
|
||||
<arg file="${builddir}/tiles_32x32.png" />
|
||||
<arg file="${builddir}/32x32" />
|
||||
</java>
|
||||
<java classname="micropolisj.build_tool.MakeTiles" classpath="${builddir}"
|
||||
fork="true" failonerror="true" dir="graphics" inputstring="">
|
||||
<sysproperty key="tile_size" value="3" />
|
||||
<arg file="graphics/tiles.rc" />
|
||||
<arg file="${builddir}/tilessm.png" />
|
||||
<arg file="${builddir}/sm" />
|
||||
</java>
|
||||
<copy todir="${builddir}" file="graphics/tiles.rc" />
|
||||
</target>
|
||||
|
|
|
@ -39,12 +39,12 @@ public class MakeTiles
|
|||
}
|
||||
|
||||
File recipeFile = new File(args[0]);
|
||||
File outputFile = new File(args[1]);
|
||||
File outputDir = new File(args[1]);
|
||||
|
||||
generateFromRecipe(recipeFile, outputFile);
|
||||
generateFromRecipe(recipeFile, outputDir);
|
||||
}
|
||||
|
||||
static void generateFromRecipe(File recipeFile, File outputFile)
|
||||
static void generateFromRecipe(File recipeFile, File outputDir)
|
||||
throws IOException
|
||||
{
|
||||
Properties recipe = new Properties();
|
||||
|
@ -82,15 +82,17 @@ public class MakeTiles
|
|||
drawTo(ref, gr, 0, TILE_SIZE*i);
|
||||
}
|
||||
|
||||
// make parent directories if necessary
|
||||
outputDir.mkdirs();
|
||||
|
||||
// output the composed images
|
||||
File outputFile = new File(outputDir, "tiles.png");
|
||||
System.out.println("Generating tiles array: "+outputFile);
|
||||
ImageIO.write(buf, "png", outputFile);
|
||||
|
||||
File indexFile = new File(
|
||||
outputFile.getParentFile(),
|
||||
outputFile.getName()
|
||||
.replaceFirst("\\.png$","")
|
||||
+ ".idx"
|
||||
);
|
||||
// output an index of all tile names and their offset into
|
||||
// the composed tile array
|
||||
File indexFile = new File(outputDir, "tiles.idx");
|
||||
System.out.println("Generating tiles index: "+indexFile);
|
||||
writeIndexFile(tileNames, indexFile);
|
||||
}
|
||||
|
|
Reference in a new issue