Dgame.System.GameController

« Go back

Bottom


struct GameController;
Represent a Game Controller

Author:
Randy Schuett (rswhite4@googlemail.com)

enum Axis: int;
Supported Game Controller Axis

Invalid


LeftX


LeftY


RightX


RightY


TriggerLeft


TriggerRight


enum Button: int;
Supported Game Controller Buttons

Invalid


A


B


X


Y


Back


Guide


Start


LeftStick


RightStick


LeftShoulder


RightShoulder


DPadUp


DPadDown


DPadLeft


DPadRight


nothrow @nogc this(int device);
CTor

nothrow @nogc bool isAttached();
Returns if the GameController has been opened and is currently connected.

nothrow @nogc short getAxisValue(Axis axis);
Returns the value of the given Axis. The value is in range of short.min .. short.max

See:
Axis enum

nothrow @nogc bool isPressed(Button btn);
Returns whether the given Button is pressed

nothrow @nogc string getName();
Returns the name of the GameController

nothrow @nogc string getMapping();
Returns the mapping of the GameController

nothrow @nogc Joystick getJoystick();
Returns the Joystick interface of the GameController

static nothrow @nogc void update();
Use this function to update the current state of the open GameController. This function is called automatically by the event loop

static nothrow @nogc string getNameForIndex(int device);
Returns the name of the GameController of the given device

static nothrow @nogc bool isGameController(int device);
Returns if the given device (e.g. a Joystick) is supported by the GameController interface.

Note:
Only if this method returns true, the device can be handled with the GameController struct


Page generated by Ddoc.

» Dgame.System.GameController on Github

Top

« Go back