Skip to content

JoyType

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

Blitz3DBlitzPlusBlitzBasic

JoyType

JoyType:Int32 port:Int32=0
Parameter Mode Type Default Description
port In Int32 0 The joystick to ask, counted from 0. Defaults to 0.

Returns: 0 if there is no joystick, 1 for a gamepad and 2 for any other joystick.

Description

Tells whether a joystick is connected to the port and what kind it is.

Differences

  • The original uses 1 for a digital and 2 for an analog joystick. Here a device that SDL recognizes as a gamepad is 1 and everything else is 2.
  • Up to 4 joysticks get a port, in the order they are found. One that is plugged in later takes the next port that was never used (once all 4 were used, it is not noticed), and one that is removed leaves its port empty (see JoyDeviceConnected).

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Cls
For p = 0 To 3
	Select JoyType(p)
		Case 0 : t$ = "not connected"
		Case 1 : t$ = "gamepad"
		Default : t$ = "other joystick"
	End Select
	Text 10, 10 + p * 16, "Port " + p + ": " + t$
Next
Flip
WaitKey

Related Commands

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

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally