Skip to content

MouseHit

Narta Xaymar Dirks edited this page Nov 1, 2026 · 9 revisions

Blitz3DBlitzPlusBlitzBasic

MouseHit

MouseHit:Int32 button:Int32
Parameter Mode Type Default Description
button In Int32 required 1 for the left, 2 for the right, 3 for the middle button, 4 for the back (X1) and 5 for the forward (X2) button.

Returns: How many times the button was pressed since the last call.

Description

Counts presses of a mouse button since the last time MouseHit asked about that button. Use it for clicks that should do one thing and not repeat while the button is held, and MouseDown for dragging.

Differences

  • Buttons 4 and 5 (the back and forward buttons) are a BlitzLLVM extension. A button number outside 1 to 5 always gives 0.
  • The Device argument is a BlitzLLVM extension: the original has no such argument and only knows one mouse.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local clicks = 0
While Not KeyHit(1)
	If MouseHit(1) Then clicks = clicks + 1
	Cls
	Text 10, 10, "Left clicks: " + clicks
	Flip
Wend

Related Commands

MouseChanged, MouseDeviceConnected, MouseDeviceCount, MouseDeviceName, MouseDown, MouseWait, MouseX, MouseXSpeed

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally