GLBasic forum

Main forum => GLBasic - en => Topic started by: mahan on 2010-Jul-14

Title: GEN*() but no FREE*() ?
Post by: mahan on 2010-Jul-14
Hi guys,

How do you release generated handles to Sprites, Files, Sounds etc.?

Since GLBasic has commands like GENSPRITE(), GENFILE() etc, I'd expect functions to release the generated handles (and associated resources) somehow, but I just don't get how. You got a command or algorithm for that?

I'm pretty sure I've seen something about this before on the forums but I could not find it now.


(Search words for the future: FreeSprite, ReleaseSprite, Free, Release, Handle, KillSprite, Kill)
Title: Re: GEN*() but no FREE*() ?
Post by: Ozden79 on 2010-Jul-14
For example, you use LOADSPRITE to load an image to an index you selected from a file. To free it, just use LOADSPRITE "",MyIndex...

That mechanic works for other items as well...
Title: Re: GEN*() but no FREE*() ?
Post by: Ian Price on 2010-Jul-14
If you load a sprite with "LOADSPRITE "image.bmp",1 then you can free it by using "LOADSPRITE "",1
Title: Re: GEN*() but no FREE*() ?
Post by: mahan on 2010-Jul-14
Thank you both, very much!  :)