Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: geork on Mon 03/05/2010 19:56:40

Title: Getting rid of a drawing surface after release()?
Post by: geork on Mon 03/05/2010 19:56:40
 Hey All!
  Just wondering whether it is possible to alter/get rid of a DrawingSurface variable after it has been released, otherwise I will have a load of GUI's to make...
  Thanks
Title: Re: Getting rid of a drawing surface after release()?
Post by: Calin Leafshade on Mon 03/05/2010 20:07:20
I dont see why you would want to...

you can always reassign the pointer or just use another one.
Title: Re: Getting rid of a drawing surface after release()?
Post by: geork on Mon 03/05/2010 20:20:52
 Whoops, my bad, I forgot to do something while reassigning. My apologies
Title: Re: Getting rid of a drawing surface after release()?
Post by: monkey0506 on Tue 04/05/2010 01:07:40
As far as the memory management goes, AGS's garbage collection will completely destroy the surface after doing:

surface = null;

Or if the pointer is assigned to point to a new DrawingSurface instead.

The same holds true for all dynamically created pointer types such as DynamicSprite and Overlay as well. Note if you're ever working with File that you should always call File.Close to ensure you don't do anything that might corrupt/overwrite your data.