Snayff / nqp2

An exploration of a fantasy world, to autobattle your way to ruling the demesne.
https://snayff.github.io/nqp2/
Other
12 stars 5 forks source link

feature/lazy_loading_images #319

Closed douglascdev closed 2 years ago

douglascdev commented 2 years ago

Implemented lazy loading for images and a base ResourceController class for handling general lazy loading, to facilitate implementation with other resources if we decide to use lazy loading for them as well.

I decided to not use weakref for the image class as it would require changes in scenes to keep images from having to repeatedly load, but it would be more memory efficient to use that in the future and then just reference the necessary resources in the Scene to keep them from loading while still releasing them from memory when the scene is over.

With the way I did it, the images are always kept in memory after loading for the first time.

Closes #318.