Closed Omegastick closed 4 years ago
Okay, here's the plan. We can do the rendering lazily to save performance rendering things that aren't really needed.
ModuleChooserWindow
(or whatever it's called) calls ModuleImageStore::get(std::string module)
. ModuleImageStore
checks it's cache and if it finds the matching image, it returns it straight away. If not, it passes the module name to ModuleFactory
to get a fully constructed module. It makes a new texture, sets it up for drawing, and does a mini-render. It's going to need its own VectorRenderer
for that. It stores the texture in its cache and returns a reference to it.
Part of #106.
I'm thinking of doing something like this:
We have a
ModuleImageStore
or something similar.ModuleImageStore
manages the textures to be used in the shop/part windows. A method calledupdate_images()
or similar goes through every module in the game (we need to register those somewhere), creates a texture for each, and renders an image of just that module onto the texture. These textures can be retrieved via some kind ofget_image(std::string module)
method.