TGamolfCustomJoystickService Class

Definition

Platform service to access to joystick/gamepad controllers on a computer

Delphi
type TGamolfCustomJoystickService = class(TInterfacedObject)
Inheritance
TInterfacedObject
TGamolfCustomJoystickService
Derived
Implements

Constructors

Methods

Count

Return the number of joysticks managed by the system

ForEach(TJoystickInfo, TJoystickInfosCallbackEvent)

Loop on all game controllers and call the method with infos for each one

ForEach(TJoystickInfo, TJoystickInfosCallbackProc)

Loop on all game controllers and call the procedure with infos for each one

ForEachConnectedDevice(TJoystickInfo, TJoystickInfosConnectedCallbackEvent, TJoystickErrorCallbackEvent)

Loop on all game controllers and call the method with infos for each connected device

ForEachConnectedDevice(TJoystickInfo, TJoystickInfosConnectedCallbackProc, TJoystickErrorCallbackProc)

Loop on all game controllers and call the procedure with infos for each connected device

StartDiscovery

Scan for availale devices (if some are already used, their ID could change)

getDPad(Byte, Boolean)

Return the DPad value between (0-359° or 65535) Compare it to Top, TopRight/RightTop, Right, BottomRight/RightBottom, Bottom, BottomLeft/LeftBottom, Left, LeftTop/TopLeft, Center values from TJoystickDPad enumeration

getDPadFromXY(Single, Single)

Get orientation (like DPad) from (x,y) axis

getInfo(Byte, TJoystickInfo)

Return a TJoystick for the JoystickID controller

getX(Byte)

Return X axes values for JoystickID controller

getXY(Byte, Single, Single)

Return X,Y axes values for JoystickID controller

getXYFromDPad(Word, Single, Single)

Get the values for (x,y) axis from a DPad/POV orientation

getY(Byte)

Return Y axes values for JoystickID controller

getZ(Byte)

Return Z axes values for JoystickID controller

hasDPad(Byte)

Check if the game controller has a DPad/POV button

hasJoystickButtonsAPI

Override this function and return true for platforms where buttons place are known. By default, it's false;

initJoystick(TJoystickInfo)

Reset Joystick structure

isConnected(Byte)

Return "true" if the JoystickID controller is connected and available

isDPad(Byte, TJoystickDPad)

Check is the DPad / POV is in a standard position for a JoystickID or in general

isDPad(Byte, array of TJoystickDPad)
isDPad(Word, TJoystickDPad)
isDPad(Word, array of TJoystickDPad)
isPressed(Byte, Byte)

Check if button "ButtonID" from controller "JoystickID" is pressed or not