menu problems

Blitz3D Forums/Blitz3D Beginners Area/menu problems

chwaga(Posted 2007) [#1]
I'm having some issues with my menu. It works all except one part: I'm trying to have a seperate menu loop, so when you press ESC, It opens a repeat ... forever loop. Before doing the menu loop, a snapshot of the current screen is taken and copied into an image (the background image). Throughout the loop, the screen is clears, the background image is drawn under everything else, to give the impression of time "freezing". However, my method does not work, the loop correctly draws the menu images and all, but not the background image, upon hitting ESC, the background is just black. Why??

That's the english version of it, here's the blitz3d version: TAKE NOTE, THE IMAGE "BGIMAGE2" IS DECLARED AS A GLOBAL IMAGE AS THE SIZE OF DISPLAYWIDTH, DISPLAYHEIGHT

If KeyHit(1) Then

	CopyRect 0, 0, displaywidth, displayheight, 0, 0, BackBuffer(), ImageBuffer(bgimage2)
	
	Repeat
		Cls 

		DrawImage bgimage2, 0, 0

		DrawImage menu, displaywidth/2, displayheight/2

		If MouseY() > 653 And MouseY() < 695 Then
		If MouseHit(1) Then
		quit=1
		Exit 
		EndIf 
		DrawImage menuhighlight, displaywidth/2, 674
		EndIf 

		If MouseY() > 745 And MouseY() < 790 Then 
 		If MouseHit(1) Then Exit
		DrawImage menuhighlight, displaywidth/2, 767

		EndIf 

		
		If KeyHit(1) Then Exit 
		DrawImage gfxmouse, MouseX(), MouseY()
		Text 10, 880, MouseY()

		Flip()
		 
	Forever
EndIf 



andy_mc(Posted 2007) [#2]
you need to copy the front buffer to the image, as you are currently drawing to the backbuffer in your game loop when this is called the backbuffer is probably empty


chwaga(Posted 2007) [#3]
I changed it to
	CopyRect 0, 0, displaywidth, displayheight, 0, 0, FrontBuffer(), ImageBuffer(bgimage2)


but it still doesn't work


chwaga(Posted 2007) [#4]
any ideas??


Stevie G(Posted 2007) [#5]
You'll need to show more code - better will, upload it with the media and I'll take a butchers.

Stevie


chwaga(Posted 2007) [#6]
It's kinda intwined with a huge game, I'll see what I can do though.


chwaga(Posted 2007) [#7]
nvm, fixed it, I just need to create a new image every time the menu is called, then delete it once the menu is exited from. wonder why...