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

Blitz3DBlitzPlusBlitzBasic

JoyHat

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

Returns: The angle of the hat, or -1 if it is centered or the joystick has no hat.

Description

The direction of the first hat switch (the point-of-view control) as an angle in degrees: 0 for up, 90 for right, 180 for down and 270 for left, with 45 degree steps in between. The result is -1 while the hat is in the middle.

Differences

  • Without any joystick the original returns -1 as well, but this runtime returns 0, which looks like "up". Use JoyType first to find out if there is a joystick.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
While Not KeyHit(1)
	Cls
	Text 10, 10, "JoyHat = " + JoyHat()
	Flip
Wend

Related Commands

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

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally