If you don’t have a project set up just yet you can download either the Java or the Kotin skeleton project to get started.
The code of this example can be found in the
zircon.examples
project here.
In order for this example to work please download the
cp437_table.xp
file from here and copy it to thesrc/main/resources/rex_files
folder in your project.
Loading Rexpaint (.xp
) files is very simple in Zircon. The following is a runnable code snippet which you can
copy and paste into your project and run:
REXPaintResource rex = REXPaintResource.loadREXFile(RESOURCE);
TileGrid tileGrid = SwingApplications.startTileGrid(AppConfig.newBuilder()
.withDefaultTileset(CP437TilesetResources.taffer20x20())
.withSize(SIZE)
.withDebugMode(true)
.build());
final Screen screen = Screen.create(tileGrid);
List<Layer> layers = rex.toLayerList(TILESET);
for (Layer layer : layers) {
screen.addLayer(layer);
}
screen.display();
After running this code you should see this on your screen: