|
Functions and classes relating to to user input. More...
Classes | |
class | ActionMap |
ActionMaps assign platform input events to console commands. More... | |
Modules | |
Input Event Listing | |
List of all possible input events that can be mapped. | |
Functions | |
void | activateDirectInput () |
Activates DirectInput. | |
void | deactivateDirectInput () |
Disables DirectInput. | |
void | disableJoystick () |
Disables use of the joystick. | |
void | disableXInput () |
Disables XInput for Xbox 360 controllers. | |
void | echoInputState () |
Prints information to the console stating if DirectInput and a Joystick are enabled and active. | |
bool | enableJoystick () |
Enables use of the joystick. | |
bool | enableXInput () |
Enables XInput for Xbox 360 controllers. | |
ActionMap | getCurrentActionMap () |
Returns the current ActionMap. | |
int | getXInputState (int controllerID, string property, bool current) |
Queries the current state of a connected Xbox 360 controller. | |
bool | isJoystickEnabled () |
Queries input manager to see if a joystick is enabled. | |
bool | isXInputConnected (int controllerID) |
Checks to see if an Xbox 360 controller is connected. | |
void | lockMouse (bool isLocked) |
Lock or unlock the mouse to the window. | |
void | resetXInput () |
Rebuilds the XInput section of the InputManager. | |
void | rumble (string device, float xRumble, float yRumble) |
Activates the vibration motors in the specified controller. |
Functions and classes relating to to user input.
Input events come from the OS, are translated in the platform layer and then posted to the game. By default the game then checks the input event against a global ActionMap (which supercedes all other action handlers). If there is no action specified for the event, it is passed on to the GUI system. If the GUI does not handle the input event it is passed to the currently active (non-global) ActionMap stack.
Example: the user presses the ~ (tilde) key, which is bound in the global ActionMap to toggleConsole.
This causes the console function associated with the bind to be executed, which in this case is toggleConsole, resulting in the console output window being shown. If the key had not been bound in the global map, it would have passed to the first gui that could have handled it, and if none did, it would pass to any game actions that were bound to that key.
void activateDirectInput | ( | ) |
Activates DirectInput.
Also activates any connected joysticks.
void deactivateDirectInput | ( | ) |
Disables DirectInput.
Also deactivates any connected joysticks.
void disableJoystick | ( | ) |
Disables use of the joystick.
void disableXInput | ( | ) |
Disables XInput for Xbox 360 controllers.
void echoInputState | ( | ) |
Prints information to the console stating if DirectInput and a Joystick are enabled and active.
bool enableJoystick | ( | ) |
Enables use of the joystick.
bool enableXInput | ( | ) |
Enables XInput for Xbox 360 controllers.
int getXInputState | ( | int | controllerID, | |
string | property, | |||
bool | current | |||
) |
Queries the current state of a connected Xbox 360 controller.
XInput Properties:
controllerID | Zero-based index of the controller to return information about. | |
property | Name of input action being queried, such as "XI_THUMBLX". | |
current | True checks current device in action. |
bool isJoystickEnabled | ( | ) |
Queries input manager to see if a joystick is enabled.
bool isXInputConnected | ( | int | controllerID | ) |
Checks to see if an Xbox 360 controller is connected.
controllerID | Zero-based index of the controller to check. |
void lockMouse | ( | bool | isLocked | ) |
Lock or unlock the mouse to the window.
When true, prevents the mouse from leaving the bounds of the game window.
void resetXInput | ( | ) |
Rebuilds the XInput section of the InputManager.
Requests a full refresh of events for all controllers. Useful when called at the beginning of game code after actionMaps are set up to hook up all appropriate events.
void rumble | ( | string | device, | |
float | xRumble, | |||
float | yRumble | |||
) |
Activates the vibration motors in the specified controller.
The controller will constantly at it's xRumble and yRumble intensities until changed or told to stop.Valid inputs for xRumble/yRumble are [0 - 1].
device | Name of the device to rumble. | |
xRumble | Intensity to apply to the left motor. | |
yRumble | Intensity to apply to the right motor. |