Skip to content

JoyDown

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

Blitz3DBlitzPlusBlitzBasic

JoyDown

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

Description

Tells whether a joystick button is held down right now. Buttons are counted from 1.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
While Not KeyHit(1)
	Cls
	If JoyType() = 0 Then
		Text 10, 10, "No joystick connected"
	Else
		For b = 1 To 8
			If JoyDown(b) Then Color 255, 80, 80 Else Color 70, 70, 70
			Rect 10 + (b - 1) * 38, 100, 30, 30, 1
		Next
	EndIf
	Color 255, 255, 255
	Flip
Wend

Related Commands

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

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally