Draw animimage to desktopbuffer

BlitzPlus Forums/BlitzPlus Programming/Draw animimage to desktopbuffer

Here's something I whipped, so it's a little rough. Basically all you do is grab the current desktop buffer and use DrawBlock instead of Cls to reset the background. The only problem I've found is it doesn't seem to catch any events so I'm not sure how you'd quit such an app. Anyway, hope this helps :)

Local background	= CreateImage(GadgetWidth(Desktop()), GadgetHeight(Desktop()))
Local myTimer		= CreateTimer(60)

; Grab the background
CopyRect(0, 0, GadgetWidth(Desktop()), GadgetHeight(Desktop()), 0, 0, DesktopBuffer(), ImageBuffer(background))

SetBuffer DesktopBuffer()

Repeat
	
	WaitEvent()
	
	; Update every 1/60 of a second
	If EventSource() = myTimer Then
		
		DrawBlock background, 0, 0
		Text Rand(0, GadgetWidth(Desktop())), Rand(0, GadgetHeight(Desktop())), "This is a test"
		Flip False
		
	EndIf
	
Forever

FreeImage background


And yes, frogs are awesome.