MouseHit() and FlushMouse Question!

BlitzPlus Forums/BlitzPlus Programming/MouseHit() and FlushMouse Question!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

try this code and put your own sound in



Graphics 800,600

ClickSound = LoadSound("YOUR_SOUND_HERE")

ButtonImage1 = CreateImage(100,30)
SetBuffer ImageBuffer(ButtonImage1)
Color 200,51,51
Rect 0,0,100,30

ButtonImage2 = CreateImage(100,30)
SetBuffer ImageBuffer(ButtonImage2)
Color 51,200,51
Rect 0,0,100,30

PointerImage = CreateImage(10,10)
SetBuffer ImageBuffer(PointerImage)
Color 51,51,255
Rect 0,0,10,10


SetBuffer BackBuffer()

Global MyMouseHit

While Not KeyHit(1)

	MyMouseHit = MouseHit(1)
	
	DrawImage PointerImage,MouseX(),MouseY()
		
	If ImagesOverlap(ButtonImage1,100,100,PointerImage,MouseX(),MouseY())			
		DrawImage ButtonImage2,100,100				
		If MyMouseHit = 1 Then
			PlaySound ClickSound
			;rest of the code
		EndIf			
	Else				
		DrawImage ButtonImage1,100,100				
	EndIf
	
	Flip

Wend

FreeImage ButtonImage1
FreeImage ButtonImage2
FreeImage PointerImage
FreeSound ClickSound

End