scrambled images after alt/tab

Blitz3D Forums/Blitz3D Beginners Area/scrambled images after alt/tab

keyboard(Posted 2004) [#1]
apologies if there is already a thread for this...

I am running a game 800x600 in full screen.
If I Alt/Tab to the desktop, and return to the game, all the images created with CreateImage are scrambled. I have tried setting the flags differently, but it does not help...


before


after

and this is the code:

Function MakeForts()

	For i% = 1 To 4	
		White.Fort = New Fort
			White\FortX = i%*147
			White\FortY = 480
			White\Pic = CreateImage(64,64,1)
			SetBuffer ImageBuffer(White\Pic)
			DrawBlock FortPic,0,0
	Next
	
End Function



thanks if you can help


SoggyP(Posted 2004) [#2]
Hi Folks,

Function MakeForts()

	For i% = 1 To 4	
		White.Fort = New Fort
			White\FortX = i%*147
			White\FortY = 480
			White\Pic = CreateImage(64,64,1)
			SetBuffer ImageBuffer(White\Pic)
			DrawBlock FortPic,0,0
	Next
	setbuffer backbuffer()
End Function


That 'might' do it.

Later,

Jes


keyboard(Posted 2004) [#3]
@SoggyP
thanks, alas, no difference.

I have the Setbuffer Backbuffer() in a different spot, but i tried it that way and its just the same. darn it.


BlitzSupport(Posted 2004) [#4]
Which version of Blitz is it?


_PJ_(Posted 2004) [#5]
That's 800x600? whoah!

Hehe - nice retro look you got there :)


SoggyP(Posted 2004) [#6]
Hi Folks,

Is this the very start of the game? If not, I'd say take a look at the code where your bases are eroded, and then try setting the buffer as backbuffer after that.

Later,

Jes


WolRon(Posted 2004) [#7]
Blitz does not like to Alt-Tab. Weird things may happen.


keyboard(Posted 2004) [#8]
Which version of Blitz is it?

sorry, should have said - Blitz+

That's 800x600? whoah!

yup :)


I'd say take a look at the code where your bases are eroded

I used your example, and no luck, thanks Jes. the main loop starts after that function call, so the setbuffer backbuffer() must happen in the function or immediately after, it doesn't seem help...


Blitz does not like to Alt-Tab. Weird things may happen.

I guess people to not Alt/tab that much in a game, but if I'm doing something else at the same time, for instance Alt/tabbing to check a download, or something...

I'm using this code now, it does not use Createimage, and does not corrupt after Alt/Tab:
	For i% = 1 To 4	
		White.Fort = New Fort
			White\FortX = i%*147
			White\FortY = 480
			White\Pic = LoadImage("data\gfx\fort.png")
	Next


thanks for help everybody


Tiger(Posted 2004) [#9]
I don't know if this helps, but try:

Image=CreateImage(64,64,1,1)



Rook Zimbabwe(Posted 2004) [#10]
Is there a way to trap the {alt}+{tab} keyhit so ir CAN'T happen???


keyboard(Posted 2004) [#11]
I don't know if this helps, but try: Image=CreateImage(64,64,1,1)


@Tiger:
It works! Hey, thanks a lot :)

My mistake was in thinking that in Image=CreateImage(64,64,1) that the "1" was referring to a flag, and not the number of frames, thanks for clearing that up. I looked at the command reference many times and was totally blind to that detail...