Skip to content

MouseDown

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

Blitz3DBlitzPlusBlitzBasic

MouseDown

MouseDown: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: 1 while the button is held down, otherwise 0.

Description

Tells whether a mouse button is held down at this moment.

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()
While Not KeyHit(1)
	Cls
	If MouseDown(1) Then Color 255, 80, 80 Else Color 80, 80, 80
	Rect 20, 60, 80, 80, 1
	If MouseDown(3) Then Color 255, 80, 80 Else Color 80, 80, 80
	Rect 120, 60, 80, 80, 1
	If MouseDown(2) Then Color 255, 80, 80 Else Color 80, 80, 80
	Rect 220, 60, 80, 80, 1
	Color 255, 255, 255
	Text 160, 200, "Hold a mouse button", 1, 1
	Flip
Wend

Related Commands

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

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally