Skip to content
Narta Xaymar Dirks edited this page Oct 30, 2026 · 7 revisions

Blitz3DBlitzPlusBlitzBasic

JoyHit

JoyHit:Int32 button:Int32, port:Int32=0
Parameter Mode Type Default Description
button In Int32 required The button number, 1 to 32.
port In Int32 0 The joystick to ask, counted from 0. Defaults to 0.

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

Description

Counts presses of a joystick button since the last time JoyHit asked about that button.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Local presses = 0
While Not KeyHit(1)
	presses = presses + JoyHit(1)
	Cls
	Text 10, 10, "Button 1 was pressed " + presses + " times"
	Flip
Wend

Related Commands

JoyChanged, JoyDeviceConnected, JoyDeviceCount, JoyDeviceName, JoyDown, JoyHat, JoyPitch, JoyRoll

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally