I'm working on a 2D game and am starting to see some short lags caused by image decompression (I'm using rather large graphics to support high resolutions). I suppose I'll have to load all my textures upfront and show a loading screen, now I'm wondering how to best go about this. I can think of two approaches:
1. Instantiate all entities for a scene when the scene is being created (Every entity is currently loading its own texture when it is being instantiated, so that should do). The manual effort seems a bit error prone though (easy to forget), and might mess up the code a bit.
2. Have a mapping from image paths to image IDs and use the IDs to load images in the code. That way I can load all the image files when the game starts. But it's tedious to add a mapping for every image I use, and not very flexible as I cannot have loading screens for individual scenes.
I'm not particularly enthusiastic about either approach. How is this commonly being solved? I can find some literature on this that focuses on huge 3D games, but that doesn't seem to apply too well to my small 2D game.