I'm trying to think of the best way to manage textures in my 2D game.
First, I am using DX11, so right now my "textures" are just pointers to a ID3D11ShaderResourceView created by D3DX11CreateShaderResourceViewFromFile. Is this how I should be loading content?
Right now my basic idea is to create a hashmap of textures with string references.
When an object is created that uses a texture it passes the reference of the texture to the hashmap and gets back a pointer to the texture. If the texture isn't loaded it will use the string to find the correct texture to load, add it to the map and pass back the pointer, so it automatically loads new textures as required (my game is turn based, and many small pauses would have no real effect).
But here are my issues:
Is the above method the best method I could be using (without it becoming overly complex)
ID3D11ShaderResourceView. Is this how I should be storing texture data in DX11?
Ideally I want to have all my texture data compressed in a file. Right now I am simply loading jpgs and so on. But I have no idea how to compress these images and selectively re-load them as required. Ideally I would want to compress them to be locatable in the file using the reference string used when searching the hashmap too.