; FreeImage Example ; ----------------- Graphics 640,480,0,2 SetBuffer BackBuffer() player=LoadImage("media/player.bmp") While Not KeyDown(1) Cls ; Space frees the image; zero the handle so we know it is gone If KeyHit(57) And player<>0 Then FreeImage player player=0 End If ; L loads the ship again after it has been freed If KeyHit(38) And player=0 Then player=LoadImage("media/player.bmp") ; Only draw the image while its handle is valid If player<>0 Then DrawImage player,MouseX(),MouseY() Text 0,0,"Space: FreeImage L: reload Esc: exit" If player<>0 Then Text 0,20,"Image handle: "+player+" - move the mouse to fly the ship" Else Text 0,20,"FreeImage called - the image memory has been released" End If Flip Wend End