Skip to content

WaitJoy

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

Blitz3DBlitzBasic

WaitJoy

WaitJoy:Int32 port:Int32=0
Parameter Mode Type Default Description
port In Int32 0 The joystick to wait for, counted from 0. Defaults to 0.

Returns: The number of the button that was pressed.

Description

The other name of JoyWait: stops the program until a joystick button is pressed and returns its number.

Differences

  • If no joystick is connected the function returns 0 right away instead of waiting forever.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Text 10, 10, "Press a joystick button"
Flip
If JoyType() <> 0 Then b = WaitJoy()
Cls
Text 10, 10, "Button " + b
Flip
Delay 1000

Related Commands

FlushJoy, GetJoy, JoyChanged, JoyDeviceConnected, JoyDeviceCount, JoyDeviceName, JoyDown, JoyWait

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally