Twinklebear / LPCGame

Working on a C++ tile based 'engine' using SDL
MIT License
18 stars 1 forks source link

Resource Manager #16

Closed Twinklebear closed 11 years ago

Twinklebear commented 11 years ago

Should some kind of resource manager be implemented? Would enable managing of resources in some way haha.

Perhaps track if a resource is no longer needed and free it? Or enable re-loading of resources to allow for immediately seeing changes?

Twinklebear commented 11 years ago

Having a good resource management system i think will make it possible to easily setup the way the Image, AnimatedImage and Text Lua libraries will be handled. Also, it should be possible to give Lua a shared_ptr since it doesn't use it internally at all, and only uses it when calling into the C library

Twinklebear commented 11 years ago

This doesn't look like it'll be needed for now, maybe in the future as an optimization?

Twinklebear commented 11 years ago

I'll be closing this, by leveraging use of overloading the gc metamethod and proper shared_ptr usage we can have Lua's garbage collector take care of the memory. Even C++ side memory in the case of Image and such where Lua has a shared_ptr and in gc it just calls the shared_ptr destructor.