Stephan van Hulst wrote:There should be absolutely no advantage to this approach, other than lower access times on disk, which is a silly optimization anyway, because you probably aren't even loading *that* many files at a time. As a matter of fact, using sprite sheets may raise the amount of memory used, because you have to load bigger parts of the image at once to be able to extract data for a particular sprite, or you have to write awkward program logic to construct the sprites without loading the entire image into memory, as you're finding out right now.
Have you actually performed tests to determine that A) using the sheet approach improves performance and B) this improvement is justified?
I only ever read that doing this sort of thing can use more memory if you're not careful...that was what I found
and I have not been able to get a running example (yes, you're right, the logic needed to actually do this is ridiculous) but I have seen it working before.
It would just make things easier in my head, I would only ever have to load one image as a singular resource, I could just draw on another tile and then write some code to implement that part. Plus, I could possibly make my own fonts etc (and given a lot of the games I try to make are kinda low res anyway, this would be really cool).
I understand its a very odd, outdated and logically bad way to do this, but I'm just looking to expand knowledge with loading images.
Here's the BufferStrategy I use (this sets each pixel).
From there, I can add a frame limiter and stuff, but the main objective is to learn how to load images this way (I have actually already practiced with separate images but to no luck unfortunately).