How many tiles are there?
about 8x6 or so (don’t know what i configured exactly)
How big are the tiles?
400x400px
How are they stored? (How many per sheet)
i use only one jpg file currently which is loaded and then re-used.
How do you load that file?
according to woogley’s instructions (see thread i mentioned above):
protected static final GraphicsDevice DEVICE = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
protected static final GraphicsConfiguration CONFIG = DEVICE.getDefaultConfiguration();
protected static final DisplayMode DISPLAY = DEVICE.getDisplayMode();
...
protected final BufferedImage getAccImg(String ref, int trans) {
BufferedImage sourceImage = null;
try {
URL url = this.getClass().getClassLoader().getResource(ref);
if (url == null) {
System.out.println("Can't find ref: "+ref);
}
// use ImageIO to read the image in
sourceImage = ImageIO.read(
new BufferedInputStream(this.getClass().getClassLoader().getResourceAsStream(ref)));
} catch (IOException e) {
System.out.println("Failed to load: "+ref);
e.printStackTrace();
}
BufferedImage image = CONFIG.createCompatibleImage(sourceImage.getWidth(),sourceImage.getHeight(),trans);
image.getGraphics().drawImage(sourceImage,0,0,null);
return image;
}
How do you draw it? (Draw only those which are on screen)
yes i only draw the visible parts of the tileset. i calculate the tile parts (if the tile is drawn at the screen edge) or use the whole tile (if drawn in the middle of the screen) and calculate the place on screen where the
(sub)images shall be drawn.
Have you checked if they get accelerated?
i have no idea how to check if an image is accelerated… :-[
i you wanna have a look at the code, here it is:
src.zip