If I make a type and one of the fields is a pointer to an image that I load in or create, when I call Delete TheType, does Blitz automatically free the image as well or should I make a destructor?
Also if I need a destructor so that I can create and free TheType multiple times in my game, would I need a destructor if TheType is only declared once as I know that blitz attempts some kind of cleanup on exit? In fact does Blitz free up types on exit if you don't!?
Cheerz
Firstly, you will need a constructor/deconstructor. But, to be honest this is good practice in any case.
And as for cleaning up, you could always use:
Delete Each TheType
Images are automatically unloaded on exit.
OK, thanks, guess I'd better make a destructor then.
Thing is I have a template type that the actual images are loaded into and all the other types just point their image pointers at the template type's images. Therefore when I free the non-template types, I don't need to free the images as they were only pointers. But I do need to free the template type images on exit (I suppose). I was just wondering if I call Delete TemplateType will blitz kill the images for me? In fact if I don't even call Delete TemplateType, will Blitz kill the type AND the images? Get it? I am just trying to be lazy and also to avert paranoia.
See I know that blitz kills images on exit but what if the pointers to them were part of a type that you have already deleted. Doesn't this leave the images without pointers, thus unfreeable, or does blitz keep track of images on its own?
Blitz never deletes the image data, when you delete a type it just frees the pointer(s).
well that definitely means I need a destructor, ho hum.