Class TGamolfCustomJoystickService
Unit
Gamolf.RTL.Joystick
Declaration
type TGamolfCustomJoystickService = class(TInterfacedObject, IGamolfJoystickService)
Description
Platform service to access to joystick/gamepad controllers on a computer
Hierarchy
- TInterfacedObject
- TGamolfCustomJoystickService
Overview
Methods
Description
Methods
 |
constructor Create; virtual; |
|
 |
destructor Destroy; override; |
|
 |
procedure initJoystick(var Joystick: TJoystickInfo); virtual; |
Reset Joystick structure
|
 |
procedure StartDiscovery; virtual; abstract; |
Scan for availale devices (if some are already used, their ID could change)
|
 |
function Count: byte; virtual; abstract; |
Return the number of joysticks managed by the system
|
 |
function isConnected(JoystickID: TJoystickID): boolean; virtual; abstract; |
Return "true" if the JoystickID controller is connected and available
|
 |
procedure getInfo(JoystickID: TJoystickID; var Joystick: TJoystickInfo); virtual; abstract; |
Return a TJoystick for the JoystickID controller
|
 |
function isPressed(JoystickID: TJoystickID; ButtonID: TButtonID): boolean; |
Check if button "ButtonID" from controller "JoystickID" is pressed or not
|
 |
procedure getXY(JoystickID: TJoystickID; var X, Y: single); |
Return X,Y axes values for JoystickID controller
|
 |
function getX(JoystickID: TJoystickID): single; |
Return X axes values for JoystickID controller
|
 |
function getY(JoystickID: TJoystickID): single; |
Return Y axes values for JoystickID controller
|
 |
function getZ(JoystickID: TJoystickID): single; |
Return Z axes values for JoystickID controller
|
 |
function getDPad(JoystickID: TJoystickID; FromXYWhenNoDPadAvailable: boolean = false): word; |
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
|
 |
function hasDPad(JoystickID: TJoystickID): boolean; virtual; abstract; |
Check if the game controller has a DPad/POV button
|
 |
function isDPad(JoystickID: TJoystickID; JoystickDPad: TJoystickDPad) : boolean; overload; |
Check is the DPad / POV is in a standard position for a JoystickID or in general
|
 |
function isDPad(DPad: word; JoystickDPad: TJoystickDPad): boolean; overload; |
|
 |
function isDPad(DPad: word; JoystickDPads: array of TJoystickDPad) : boolean; overload; |
|
 |
function getDPadFromXY(X, Y: single): word; |
Get orientation (like DPad) from (x,y) axis
|
 |
procedure getXYFromDPad(DPad: word; var X, Y: single); |
Get the values for (x,y) axis from a DPad/POV orientation
|
 |
function hasJoystickButtonsAPI: boolean; virtual; |
Override this function and return true for platforms where buttons place are known. By default, it's false;
If "true" use TJoystickButtons enumeration to check if a button is pressed. If "false" use buttons ID to check if a button is pressed.
|
Delphi Game Engine (c) 2021-2025
Patrick PREMARTIN - Powered by
PasDoc
Generated by PasDoc 0.16.0.