Unit Gamolf.RTL.Joystick

Description

C2PP ***************************************************************************

Delphi Game Engine Copyright (c) 2021-2026 Patrick PREMARTIN

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

***************************************************************************

Delphi Game Engine contains libraries and components to use in VCL or FireMonkey game (or classic) projects.

If you want to play sounds or musics, use game controllers, pilot your user interface with the keyboard or a game controller, it's the good place.

***************************************************************************

Author(s) : Patrick PREMARTIN

Site : https://delphigameengine.developpeur-pascal.fr

Project site : https://github.com/DeveloppeurPascal/Delphi-Game-Engine

*************************************************************************** File last update : 2025-05-25T17:36:34.024+02:00 Signature : 8b790f4a797fa86714826b6bb3c46f9ada99574b ***************************************************************************

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class EJoystickServiceException Base class for all Joystick exceptions
Class EJoystickUnpluggedException Raised if the controller is not available
Record TJoystickInfo Joystick/gamepad controller datas
Interface IGamolfJoystickService Platform service to access to joystick/gamepad controllers on a computer
Class TGamolfCustomJoystickService Platform service to access to joystick/gamepad controllers on a computer
Class TGamepadDevicesManager Gamepad manager class, to use as a singleton.
Class TDGEGamepadManager Gamepad manager component
Class TGamepadManagerList  
Class TGamepadDevice Gamepad class to access data from each gamepad detected on the system
Class TGamepadDeviceDict  
Class TDGEGamepad Gamepad component
Class TDGEGamepadList  

Functions and Procedures

procedure Register;

Types

TJoystickButtons = (...);
TJoystickButtonsSet = set of TJoystickButtons;
TJoystickDPad = (...);
TJoystickAxes = (...);
TJoystickAxesSet = set of TJoystickAxes;
TJoystickID = byte;
TButtonID = byte;
TJoystickInfosCallbackProc = reference to procedure(JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo; hadError: boolean);
TJoystickInfosCallbackEvent = procedure(JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo; hadError: boolean) of object;
TJoystickInfosConnectedCallbackProc = reference to procedure (JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo);
TJoystickInfosConnectedCallbackEvent = procedure(JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo) of object;
TJoystickErrorCallbackProc = reference to procedure(JoystickID: TJoystickID);
TJoystickErrorCallbackEvent = procedure(JoystickID: TJoystickID) of object;
TOnNewGamepadDetected = procedure(const GamepadID: integer) of object;
TOnGamepadLost = procedure(const GamepadID: integer) of object;
TOnGamepadButtonUp = procedure(const GamepadID: integer; const Button: TJoystickButtons) of object;
TOnGamepadButtonDown = procedure(const GamepadID: integer; const Button: TJoystickButtons) of object;
TOnGamepadAxesChange = procedure(const GamepadID: integer; const Axe: TJoystickAxes; const Value: single) of object;
TOnGamepadDirectionPadChange = procedure(const GamepadID: integer; const Value: TJoystickDPad) of object;

Description

Functions and Procedures

procedure Register;

This item has no description.

Types

TJoystickButtons = (...);

ID for game controllers buttons (when it's know by the API)

Values
  • A
  • B
  • X
  • Y
  • LeftShoulder
  • RightShoulder
  • Options
  • Menu
  • LeftThumbStick
  • RightThumbStick
  • Home
  • LeftTrigger
  • RightTrigger
TJoystickButtonsSet = set of TJoystickButtons;

This item has no description.

TJoystickDPad = (...);

DPad standard values (from 0 to 365° and 65535 when not value is selected)

Values
  • Top = 0
  • TopRight = 45
  • RightTop = 45
  • Right = 90
  • BottomRight = 135
  • RightBottom = 135
  • Bottom = 180
  • BottomLeft = 225
  • LeftBottom = 225
  • Left = 270
  • LeftTop = 315
  • TopLeft = 315
  • Center = 65535
TJoystickAxes = (...);

This item has no description.

Values
  • LeftStickX = 0
  • X = 0
  • LeftStickY = 1
  • Y = 1
  • RightStickX = 2
  • U = 2
  • RightStickY = 3
  • R = 3
  • LeftTrigger = 4
  • Z = 4
  • RightTrigger = 5
  • V = 5
TJoystickAxesSet = set of TJoystickAxes;

This item has no description.

TJoystickID = byte;

Type for Joystick ID

TButtonID = byte;

Type for Button ID

TJoystickInfosCallbackProc = reference to procedure(JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo; hadError: boolean);

Signature for a callback procedure used to get game controller infos

TJoystickInfosCallbackEvent = procedure(JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo; hadError: boolean) of object;

Signature for a callback method used to get game controller infos

TJoystickInfosConnectedCallbackProc = reference to procedure (JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo);

Signature for a callback procedure used to get connected game controller infos

TJoystickInfosConnectedCallbackEvent = procedure(JoystickID: TJoystickID; var JoystickInfo: TJoystickInfo) of object;

Signature for a callback method used to get connected game controller infos

TJoystickErrorCallbackProc = reference to procedure(JoystickID: TJoystickID);

Signature for a callback procedure used to signal an error for the game controller JoystickID

TJoystickErrorCallbackEvent = procedure(JoystickID: TJoystickID) of object;

Signature for a callback method used to signal an error for the game controller JoystickID

TOnNewGamepadDetected = procedure(const GamepadID: integer) of object;

This item has no description.

TOnGamepadLost = procedure(const GamepadID: integer) of object;

This item has no description.

TOnGamepadButtonUp = procedure(const GamepadID: integer; const Button: TJoystickButtons) of object;

This item has no description.

TOnGamepadButtonDown = procedure(const GamepadID: integer; const Button: TJoystickButtons) of object;

This item has no description.

TOnGamepadAxesChange = procedure(const GamepadID: integer; const Axe: TJoystickAxes; const Value: single) of object;

This item has no description.

TOnGamepadDirectionPadChange = procedure(const GamepadID: integer; const Value: TJoystickDPad) of object;

This item has no description.

Delphi Game Engine (c) 2021-2026 Patrick PREMARTIN - Powered by PasDoc
Generated by PasDoc 1.0.2.