Changing the resolution will flush the graphics buffer.. that command returns 1 once if that happened
btw, reloading? i prefer saving objects and images on memblocks, they are not lost when alt-tabbing
take a look:
Set Window off
set display mode 800,600,32
Sync On
makeRandomImage(1,128,128)
makeRandomImage(2,128,128)
cls
sync
ink rgb(255,255,255),0
print "Created 2 random images"
sync
Wait Key
Make Memblock From Image 1,2
print "Saved the last one in a memblock"
sync
Wait Key
v = Screen Invalid()
cls
while Screen Invalid() = 0
text 0,0,"Image exist(1): " + str$(Image Exist(1))
text 0,20,"Image exist(2): " + str$(Image Exist(2))
text 0,40,"Memblock exist(1): " + str$(Memblock Exist(1))
text 0,60,"Now go to desktop and back again"
Paste Image 1, 200, 100
Paste Image 2, 350, 100
text 200,235,"IMAGE 1"
text 350,235,"IMAGE 2"
sync
endwhile
cls
sync
print "Screen invalid returned 1!"
print "Now:"
print
print "Image exist(1): ", Image Exist(1)
print "Image exist(2): ", Image Exist(2)
print "Memblock exist(1): ", Memblock Exist(1)
sync
Wait Key
print "As you see, memblock still exists"
print "and converting it to a image will be much faster than reloading the file"
sync
Wait Key
cls
Make Image From Memblock 2,1
print ":)"
Paste Image 2, 350, 100
text 200,235,"IMAGE 1 x.x"
text 350,235,"IMAGE 2"
sync
Wait Key
end
function makeRandomImage(num, width, height)
Create Bitmap 1, 128, 128
Set Current Bitmap 1
ink rgb(rnd(255),rnd(255),rnd(255)),0 `random color
box 0,0,128,128
for dots = 1 to 100
dot rnd(128),rnd(128),rgb(rnd(255),rnd(255),rnd(255))
next dots
Get Image num,0,0,width,height
Delete Bitmap 1
Set Current Bitmap 0
endfunction