Class TGamepadDevicesManager

Unit

Declaration

type TGamepadDevicesManager = class(TInterfacedObject)

Description

Gamepad manager class, to use as a singleton.

Hierarchy

Overview

Methods

Protected constructor Create;
Protected destructor Destroy; override;
Protected procedure Execute;
Protected procedure RegisterGamePadDevice(const Gamepad: TGamepadDevice);
Protected procedure UnRegisterGamePadDevice(const Gamepad: TGamepadDevice);
Protected procedure RegisterGamePadManager(const Manager: TDGEGamepadManager);
Protected procedure UnRegisterGamePadManager(const Manager: TDGEGamepadManager);
Protected procedure DoNewGamepadDetected(const AGamepadID: integer);
Protected procedure DoLostGamepad(const AGamepadID: integer);
Protected procedure DoGamepadDirectionPadChange(const AGamepadID: integer; const AValue: TJoystickDPad);
Protected procedure DoGamepadAxesChange(const AGamepadID: integer; const AAxe: TJoystickAxes; const AValue: single);
Protected procedure DoGamepadButtonDown(const AGamepadID: integer; const AButton: TJoystickButtons);
Protected procedure DoGamepadButtonUp(const AGamepadID: integer; const AButton: TJoystickButtons);
Protected function IsGamepadConnected(const GamepadID: integer): boolean;
Public class function Current: TGamepadDevicesManager;
Public class constructor Create;
Public class destructor Destroy;
Public function GetGamepad(const AID: integer): TGamepadDevice;
Public function GamepadCount: integer;
Public function ConnectedGamepadCount: integer;

Properties

Public property IsSupported: boolean read GetIsSupported;
Public property Enabled: boolean read FEnabled write SetEnabled;
Public property SynchronizedEvents: boolean read FSynchronizedEvents write SetSynchronizedEvents;
Public property OnNewGamepadDetected: TOnNewGamepadDetected read FOnNewGamepadDetected write SetOnNewGamepadDetected;
Public property OnGamepadLost: TOnGamepadLost read FOnGamepadLost write SetOnGamepadLost;
Public property OnGamepadButtonUp: TOnGamepadButtonUp read FOnGamepadButtonUp write SetOnGamepadButtonUp;
Public property OnGamepadButtonDown: TOnGamepadButtonDown read FOnGamepadButtonDown write SetOnGamepadButtonDown;
Public property OnGamepadAxesChange: TOnGamepadAxesChange read FOnGamepadAxesChange write SetOnGamepadAxesChange;
Public property OnGamepadDirectionPadChange: TOnGamepadDirectionPadChange read FOnGamepadDirectionPadChange write SetOnGamepadDirectionPadChange;
Public property Tag: integer read FTag write SetTag;
Public property TagBool: boolean read FTagBool write SetTagBool;
Public property TagFloat: single read FTagFloat write SetTagFloat;
Public property TagObject: TObject read FTagObject write SetTagObject;
Public property TagString: string read FTagString write SetTagString;

Description

Methods

Protected constructor Create;
 
Protected destructor Destroy; override;
 
Protected procedure Execute;
 
Protected procedure RegisterGamePadDevice(const Gamepad: TGamepadDevice);
 
Protected procedure UnRegisterGamePadDevice(const Gamepad: TGamepadDevice);
 
Protected procedure RegisterGamePadManager(const Manager: TDGEGamepadManager);
 
Protected procedure UnRegisterGamePadManager(const Manager: TDGEGamepadManager);
 
Protected procedure DoNewGamepadDetected(const AGamepadID: integer);
 
Protected procedure DoLostGamepad(const AGamepadID: integer);
 
Protected procedure DoGamepadDirectionPadChange(const AGamepadID: integer; const AValue: TJoystickDPad);
 
Protected procedure DoGamepadAxesChange(const AGamepadID: integer; const AAxe: TJoystickAxes; const AValue: single);
 
Protected procedure DoGamepadButtonDown(const AGamepadID: integer; const AButton: TJoystickButtons);
 
Protected procedure DoGamepadButtonUp(const AGamepadID: integer; const AButton: TJoystickButtons);
 
Protected function IsGamepadConnected(const GamepadID: integer): boolean;
 
Public class function Current: TGamepadDevicesManager;
 
Public class constructor Create;
 
Public class destructor Destroy;
 
Public function GetGamepad(const AID: integer): TGamepadDevice;

Return the gamepad data class

Public function GamepadCount: integer;

Count the detected gamepads number (detected or declared in the OS depending on the platform)

Public function ConnectedGamepadCount: integer;

Return the connected gamepads number

Properties

Public property IsSupported: boolean read GetIsSupported;

Check if the gamepad API is available for this platform

Public property Enabled: boolean read FEnabled write SetEnabled;

Start or stop the gamepad infos check loop

Public property SynchronizedEvents: boolean read FSynchronizedEvents write SetSynchronizedEvents;

Execute events in main thread or in the thread used by the gamepad manager

Public property OnNewGamepadDetected: TOnNewGamepadDetected read FOnNewGamepadDetected write SetOnNewGamepadDetected;

Used when a new gamepad is detected (it should be connected but can be not).

Public property OnGamepadLost: TOnGamepadLost read FOnGamepadLost write SetOnGamepadLost;

To know if a connected gamepad is disconnected from the system or powered off.

Public property OnGamepadButtonUp: TOnGamepadButtonUp read FOnGamepadButtonUp write SetOnGamepadButtonUp;

Called when a gamepad button is up (unpressed)

Public property OnGamepadButtonDown: TOnGamepadButtonDown read FOnGamepadButtonDown write SetOnGamepadButtonDown;

Called when a gamepad button is down (pressed)

Public property OnGamepadAxesChange: TOnGamepadAxesChange read FOnGamepadAxesChange write SetOnGamepadAxesChange;

Called for each new value of a gamepad axe (X,Y or others)

Public property OnGamepadDirectionPadChange: TOnGamepadDirectionPadChange read FOnGamepadDirectionPadChange write SetOnGamepadDirectionPadChange;

Called for each direction change from a gamepad DPAD (if available on it)

Public property Tag: integer read FTag write SetTag;

Tag property "in case of" not used in this class

Public property TagBool: boolean read FTagBool write SetTagBool;

TagBool property "in case of" not used in this class

Public property TagFloat: single read FTagFloat write SetTagFloat;

TagFloat property "in case of" not used in this class

Public property TagObject: TObject read FTagObject write SetTagObject;

TagObject property "in case of" not used in this class

Public property TagString: string read FTagString write SetTagString;

TagString property "in case of" not used in this class

Delphi Game Engine (c) 2021-2025 Patrick PREMARTIN - Powered by PasDoc
Generated by PasDoc 0.16.0.