Hello all. If I want to store and load images for a game, what is the best way to go about it? I’m interested in the following:
Hardware-acceleration? (If I remember correctly, this rules out Toolkit.getImage()).
Format? I hear PNG is the best. I’m interested in basic, small sprites (32x32 or 64x64) with single transparency (BITMASK?)
Transparency? Last time I tested, for some reason, TRANSLUCENT was actually better and faster than BITMASK. This was around the release of 1.4.0.
Classpath? Using ImageIO and Toolkit, they want a URL or a filename. If you JAR up your entire package including images, it makes more sense to use getResourceAsStream(). I’d rather my images be found on the classpath than through absolute or relative file names.
So in essence, I’m looking for the best format to write an image in for gaming. Afterwards, I’d like to load that image and maintain transparency, have hardware-acceleration, and be found on the classpath.
Too much to ask? I’m hoping there’s some kind of best practice. No third-party libraries either. I’m aware of GAGE and LWJGL, but this is a learning exercise for me and I’d like to do it using core libraries and extensions. Some of you might remember my Pacman project over a year ago, and I’m trying to improve on that again. The images were rendered at runtime using Arc2D and Rectangles, so I never worried about loading them before.
Thanks for any help!
Michael Bishop