According to PG's code I have this in my code:
Code:
private readonly Sprite[,] map = new Sprite[MapWidth,MapHeight];
private const int MapWidth = 10;
private const int MapHeight = 10;
This is sufficient for the start resolution and I assume for this example that it fits the screen nicely. Now the player changes the resolution so there is room for 20*20 tiles.
Now I have 2 possibilities:
1) Upscale everything so it fits again (not really wanted by me as it looks horrible depending on the images)
2) Change the rendersize of the map to support the new tiles
What I want is possibility 2, I want to render the new tiles. My problem is that the buffer is already initialised and I have enough sprites for 10*10 tiles but not for 20*20 tiles.
My question is how to solve this problem in a good way as it is (in my opinion) not really good to deactivate all old sprites and create a new 20*20 array of sprites for rendering (would waste too much memory until the GC is collecting and maybe the old memory will never get freed as the entity system maybe still could hold references)
Personally I prefer to reuse old things so how can I grow the buffer but behold the old sprites? Shrinking the buffer is no problem because I can deactivate all sprites which are not needed (for example we have a buffer of 20*20 and the screen is shrinked to 10*10 tiles, then I only deactivate the tiles outside of the render-area to stop them for update etc)
Maybe it's the best to create a large buffer at start, depending on the platform (for example on PC I create a buffer which is capable to hold enough tiles for 1024*768px and offer that as maximum resolution whereas on WP7/8 I only create a buffer for the phone's resolution as it generally doesn't change)
I hope this time it's more understandable because I'm horrible in explaining things on english due to the fact that I can't speak english very well (meanwhile it's sufficient enough to talk but I still lack skills)