Destroying sub bitmaps?

What happens when you destroy a sub-bitmap? Is destroying sub-bitmaps necessary?

Itachihro said:

What happens when you destroy a sub-bitmap?

The sub bitmap is destroyed. The parent bitmap is untouched.


Is destroying sub-bitmaps necessary?



Well damn, in that case I somehow need a special case for handling sub-bitmaps in my sprite managers. I knew this wasn't going to be quite as easy as I thought it would.

Todd Cope

Maybe this will help: al_is_sub_bitmap(). Otherwise, not sure what you could be doing that would be difficult to deal with.


I'm managing my resources with smart pointers, so for sub bitmaps I have to keep a reference to the parent bitmap (so it doesn't get destroyed prematurely) as well as to the actual sub bitmap, so it made it a little less pleasant (I previously hoped I'd get away with ignoring the differences between the two) (I ended up writing subclasses for both cases, and then wrapping those in another class to hide pointer usage).

Temia Eszteri

Perhaps you could maintain an array of pointers to reference which sub-bitmaps have branched from a parent one? Or a basic reference counter, one of the two. That way if you need to destroy a parent bitmap for whatever reason, it won't happen if it's in use.

Thread #610726. Printed from