Skip to content

GetMouse

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

Blitz3DBlitzPlusBlitzBasic

GetMouse

GetMouse:Int32

Returns: The number of the button that was pressed, or 0 if there is none.

Description

Takes the next mouse button press out of a queue and returns its number: 1 for the left button, 2 for the right, 3 for the middle button, 4 for the back and 5 for the forward button. It returns 0 if nothing was pressed since the last call. Unlike MouseHit it does not need to be told which button to look at.

Differences

  • Buttons 4 and 5 (the back and forward buttons) are a BlitzLLVM extension.
  • The queue holds 15 presses and forgets the oldest ones when it is full.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local prev = 0
While Not KeyHit(1)
	Local b = GetMouse()
	If b Then prev = b
	Cls
	Text 10, 10, "Click with any mouse button"
	Text 10, 30, "Last button: " + prev
	Flip
Wend

Related Commands

FlushMouse, LastMouseDevice, LockMouse, MouseChanged, MouseDeviceConnected, MoveMouse, UnlockMouse, WaitMouse

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally