I recently realized
IDisposable, and now (while trying to track down a memory leak) wonder about where and when I should dipose this.
My current architecture is that I have a
SpriteComponent instance which encapsulates and hides the
Texture2D. Internally, when I switch screens (eg.
WorldMapScreen), I call
Dispose on the current screen, which calls dispose on the entities, which calls dispose on the textures.
But this results in some wacked-out behaviour, like textures apprearing super zoomed in momentarily, or appearing black, or appearing as garbage image data.
So my question is really, when should I call
(FYI, I also can switch to a screen, and then later switch back to it, which currently causes me to reload the sprites, and by proxy, the textures.)