I’m writing a game framework that I will use for making java2D games (I will do an jogl or lwjgl version later, havn’t decided which yet), and for tiled games I use all the tiles for a given location from a single image (rm2k chipsets actualy). Right now I am breaking this image into pieces when the level is loaded and storing all the tile images in a BufferedImage[][], this allows me to draw my maps plenty fast, but it takes a bit too much time to do the breaking it into tiles part. Is there a way where I can get similar rendering speeds without such a big load time? here is my code for breaking the image into tiles:
private void createTileImages()
{
Graphics2D g2;
GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
for (int row = 0; row < tileImages.length; row++)
{
for (int col = 0; col < tileImages[row].length; col++)
{
tileImages[row][col] = gc.createCompatibleImage(Game.TILE_WIDTH, Game.GAME_HEIGHT, Transparency.BITMASK);
g2 = tileImages[row][col].createGraphics();
g2.drawImage(image, 0-col*Game.TILE_WIDTH, 0-row*Game.TILE_HEIGHT, null);
}
}
}