programming buttons

BlitzMax Forums/BlitzMax Programming/programming buttons

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.

the $FF000000 represents an AARRGGBB integer, the $FF portion being full opacity, doing a bitwise AND between it and the pixel we are checking will return a boolean true when the pixel has full opacity

Technically, that line could be changed to:
Return pix & $FF000000

in fact a further optimisation could be:
Method HitTest:Int(hitX:Float, hitY:Float)
	Return ReadPixel(_pixmap, hitX, hitY) & $FF000000
End Method


And if further optimised could be something like:
If ReadPixel(_pixmap, MouseX()-X, MouseY()-Y) & $FF000000 Then
	If (onClick <> Null) Then
		onClick()
	EndIf
EndIf


I'm not sure I'm explaining it as well as I could, my brain understands it better than I do.