I have seen a lot of tutorials, and they develop games with 2 different ways:
The first one is using a virtual image (BufferedImage) and filling it's pixels. And displaying virtual picture.
private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); private int pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); private int colors = new int[6 * 6 * 6];
Second one is using lots of real images. And displaying they.
SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png")); //PLAYER SPRITES PROVIDED BY: AddFact player = sheet.crop(width * 4, 0, width, height); dirt = sheet.crop(width, 0, width, height); grass = sheet.crop(width * 2, 0, width, height); stone = sheet.crop(width * 3, 0, width, height); tree = sheet.crop(0, 0, width, height);
First Question: Which one has the best performance ?
Second Question: How should we load maps? With images or with text files ? Which one is good to chose ?
Sorry for my english. I hope I can explain to you :) Thanks for helping, have a nice day ^^