Class TGameController
Unit
Declaration
type TGameController = class(TObject)
Description
Properties of a given game controller (joystick, gamepad). Get instance of this by Controllers[Index].
Do not construct instances of this yourself, TGameControllers creates this automatically when necessary.
All the contents of this class are read-only for applications. Only the controller backends (that implement TGameController
logic using underlying system-specific APIs) can change it.
Hierarchy
- TObject
- TGameController
Overview
Fields
![]() |
Name: String; |
![]() |
Pressed: array [TGameControllerButton] of Boolean; |
![]() |
InternalPressedToReport: array [TGameControllerButton] of Boolean; |
Methods
![]() |
function AxisLeft: TVector2; |
![]() |
function AxisRight: TVector2; |
![]() |
function AxisLeftTrigger: Single; |
![]() |
function AxisRightTrigger: Single; |
![]() |
function ButtonCaption(const Button: TGameControllerButton): String; |
![]() |
function ButtonMeaning(const Button: TGameControllerButton): TGameControllerButtonMeaning; |
![]() |
destructor Destroy; override; |
Description
Fields
![]() |
Name: String; |
Game controller name. Not necessarily unique, so be sure to display also game controller index to the user in UI. |
![]() |
Pressed: array [TGameControllerButton] of Boolean; |
Which buttons are now pressed. |
![]() |
InternalPressedToReport: array [TGameControllerButton] of Boolean; |
New state of buttons' pressed, to be reported by next TCastleContainer.Update, and it will be the new value of Pressed. |
Methods
![]() |
function AxisLeft: TVector2; |
Left analog stick position. Both coordinates are in range -1..1, where (0, 0) is the center of the stick. Note: It is not guaranteed that they fit within the circle of radius 1 (they usually don't, they go a bit outside the circle). But it is also not guaranteed that they can reach the edge of the square, e.g. position (-1,-1) may not be reachable, usually it is not reachable. So: Your application should not assume that user can make a stick position beyond the circle of radius 1, but it should accept such positions. |
![]() |
function AxisRight: TVector2; |
Right analog stick position. See TGameController.AxisLeft for details of possible values. |
![]() |
function AxisLeftTrigger: Single; |
Left trigger axis, in range 0..1. |
![]() |
function AxisRightTrigger: Single; |
Right trigger axis, in range 0..1. |
![]() |
function ButtonCaption(const Button: TGameControllerButton): String; |
Nice caption (label) of a given button. For buttons that have different names depending on the game controller, like "face buttons" (A, B, X, Y, square triangle circle cross), this caption depends on the game controller type. TODO: The current implementation assumes
|
![]() |
function ButtonMeaning(const Button: TGameControllerButton): TGameControllerButtonMeaning; |
Intended meaning of the given button. This may depend on the game controller type. TODO: The current implementation assumes
|
![]() |
destructor Destroy; override; |
This item has no description. |
Generated by PasDoc 0.16.0-snapshot.