Detect mouse in an area?

BlitzMax Forums/BlitzMax Programming/Detect mouse in an area?

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.

found this version in archives.. works a treat =D

Graphics 800,600,0,60

SetBlend ALPHABLEND
Repeat ; cls

	If GenericPointInQuad(mousex(),mousey(),0,0,64,0,64,64,0,64)=1 Then DrawText "wohoo",200,200 Else DrawText "doh!",200,200
	DrawText MouseX()+"/"+Mousey(),10,10
	
Flip ; Until KeyDown(KEY_ESCAPE) ; End

Function GenericPointInQuad (x, y, x0, y0, x1, y1, x2, y2, x3, y3) ' clockwise
	If ((y - y0) * (x1 - x0)) - ((x - x0) * (y1 - y0)) <= 0 Then Return 0
	If ((y - y1) * (x2 - x1)) - ((x - x1) * (y2 - y1)) <= 0 Then Return 0
	If ((y - y2) * (x3 - x2)) - ((x - x2) * (y3 - y2)) <= 0 Then Return 0
	If ((y - y3) * (x0 - x3)) - ((x - x3) * (y0 - y3)) <= 0 Then Return 0
	Return True
End Function