Class TJoysticks

Unit

Declaration

type TJoysticks = class(TObject)

Description

TJoysticks is a class for joysticks and gamepads management

Hierarchy

Overview

Methods

Protected procedure DoChange;
Public constructor Create;
Public destructor Destroy; override;
Public function GetInfo( JoyID : Byte ) : PJoyInfo;
Public function AxisPos( JoyID, Axis : Byte ): Single;
Public function Down( JoyID, Button : Byte ): Boolean;
Public function Up( JoyID, Button : Byte ): Boolean;
Public function Press( JoyID, Button : Byte ): Boolean;
Public procedure ClearState;
Public function GetJoy(const JoyID: Integer): TJoystick; deprecated 'use Joysticks[xxx] instead of Joysticks.GetJoy(xxx)';
Public function JoyCount: Integer; deprecated 'use Count';
Public function Count: Integer;
Public procedure Initialize;

Properties

Public property OnAxisMove: TOnJoyAxisMove read FOnAxisMove write FOnAxisMove;
Public property OnButtonDown: TOnJoyButtonEvent read FOnButtonDown write FOnButtonDown;
Public property OnButtonUp: TOnJoyButtonEvent read FOnButtonUp write FOnButtonUp;
Public property OnButtonPress: TOnJoyButtonEvent read FOnButtonPress write FOnButtonPress;
Public property Items[constIndex:Integer]: TJoystick read GetItems;
Public property Initialized: Boolean read FInitialized;
Public property OnChange: TNotifyEvent read FOnChange write FOnChange;
Public property OnDisconnect: TSimpleNotifyEvent read FOnDisconnect write FOnDisconnect;
Public property OnConnect: TSimpleNotifyEvent read FOnConnect write FOnConnect;

Description

Methods

Protected procedure DoChange;

See OnChange.

Public constructor Create;
 
Public destructor Destroy; override;
 
Public function GetInfo( JoyID : Byte ) : PJoyInfo;
 
Public function AxisPos( JoyID, Axis : Byte ): Single;
 
Public function Down( JoyID, Button : Byte ): Boolean;
 
Public function Up( JoyID, Button : Byte ): Boolean;
 
Public function Press( JoyID, Button : Byte ): Boolean;
 
Public procedure ClearState;
 
Public function GetJoy(const JoyID: Integer): TJoystick; deprecated 'use Joysticks[xxx] instead of Joysticks.GetJoy(xxx)';

Warning: this symbol is deprecated: use Joysticks[xxx] instead of Joysticks.GetJoy(xxx)

 
Public function JoyCount: Integer; deprecated 'use Count';

Warning: this symbol is deprecated: use Count

 
Public function Count: Integer;
 
Public procedure Initialize;

Detect connected joysticks. On some platforms, you need to call this to search for connected joysticks, otherwise you will always have zero joysticks. Calling this again is allowed, it searches for connected joysticks again.

Properties

Public property OnAxisMove: TOnJoyAxisMove read FOnAxisMove write FOnAxisMove;
 
Public property OnButtonDown: TOnJoyButtonEvent read FOnButtonDown write FOnButtonDown;
 
Public property OnButtonUp: TOnJoyButtonEvent read FOnButtonUp write FOnButtonUp;
 
Public property OnButtonPress: TOnJoyButtonEvent read FOnButtonPress write FOnButtonPress;
 
Public property Items[constIndex:Integer]: TJoystick read GetItems;
 
Public property Initialized: Boolean read FInitialized;
 
Public property OnChange: TNotifyEvent read FOnChange write FOnChange;

Called after TJoystick instances on the list change (some are added, destroyed). In case of some backends, this is only called at the end of Initialize, but it may be called in other cases (e.g. "explicit" joystick backend, used by Nintendo Switch, may call this at any moment).

Public property OnDisconnect: TSimpleNotifyEvent read FOnDisconnect write FOnDisconnect;

Called in case a previously initalized joystick has been disconnected.

Public property OnConnect: TSimpleNotifyEvent read FOnConnect write FOnConnect;

Called in case a joystick has been connected to the system.


Generated by PasDoc 0.16.0.