Drag[en]gine Script Module DragonScript
1.23
|
Generate default bindings. More...
Public Member Functions | |
Constructors | |
DefaultBindingHelper | new () |
Create default binding helper using BaseGameApp. More... | |
DefaultBindingHelper | new (BindingManager bindingManager, CommandManager commandManager) |
Create default binding helper for binding manager. More... | |
General | |
BindingManager | getBindingManager () |
Binding manager to update once finished. More... | |
CommandManager | getCommandManager () |
Command manager to use for bindings. More... | |
void | reset () |
Remove all bindings. More... | |
void | updateBindingManager (bool clear) |
Update binding manager with found bindings. More... | |
bool | mouseBindWheel (int wheel, String command) |
Bind command to mouse wheel. More... | |
bool | mouseBindWheel (int wheel, String up, String down) |
Bind commands to mouse wheel. More... | |
bool | mouseBindLMR (String left, String middle, String right) |
Bind command to left, right and middle mouse buttons. More... | |
bool | mouseBindAux (int number, String command) |
Bind command to auxiliary mouse button. More... | |
Keyboard Input Device | |
bool | hasKeyboard () |
Keyboard device is present. More... | |
InputDevice | getKeyboard () |
First keyboard device or null. More... | |
void | keyboardClear () |
Remove all keyboard bindings. More... | |
bool | keyboardBindKeyCode (int keyCode, String command) |
Bind command to keyboard key matching key code. More... | |
bool | keyboardBindKeyCode (int keyCode, InputEventKeyLocation location, String command) |
Bind command to keyboard key matching key code. More... | |
bool | keyboardBindCharacter (int character, String command) |
Bind command to keyboard key matching character. More... | |
bool | keyboardBindCharacter (int character, InputEventKeyLocation location, String command) |
Bind command to keyboard key matching character. More... | |
Gamepad Binding | |
bool | hasGamepad () |
Gamepad device is present. More... | |
InputDevice | getGamepad () |
First gamepad device or null. More... | |
void | gamepadClear () |
Remove all gamepad bindings. More... | |
bool | gamepadBindStick (int stick, String horizontal, String vertical) |
Bind command to gamepad stick. More... | |
bool | gamepadBindStick (int stick, String left, String right, String up, String down) |
Bind command to gamepad stick. More... | |
bool | gamepadBindHat (int hat, String horizontal, String vertical) |
Bind command to gamepad hat or directional pad. More... | |
bool | gamepadBindHat (int hat, String left, String right, String up, String down) |
Bind command to gamepad hat or directional pad. More... | |
bool | gamepadBindTrigger (int trigger, String command) |
Bind command to gamepad trigger. More... | |
bool | gamepadBindTrigger (int trigger, String pull, String release) |
Bind command to gamepad trigger. More... | |
bool | gamepadBindButton (int button, String command) |
Bind command to gamepad button. More... | |
bool | gamepadBindButton (int button, InputDeviceButtonType type, String command) |
Bind command to gamepad button. More... | |
VR Controller Binding | |
bool | hasVRHand (bool rightHand) |
One or more VR hand controller device is present. More... | |
InputDevice | getVRHand (bool rightHand) |
First VR hand controller device or null. More... | |
Array | getAllVRHands (bool rightHand) |
All VR hand controller devices as Array of InputDevice. More... | |
bool | bindButton (InputDevice device, int button, String command) |
Bind command to button on device. More... | |
bool | bindButton (InputDevice device, InputDeviceButtonType type, int button, String command) |
Bind command to button on device. More... | |
bool | bindTrigger (InputDevice device, InputDeviceAxisType type, int trigger, String name) |
Bind command to trigger. More... | |
bool | bindTrigger (InputDevice device, InputDeviceAxisType type, int trigger, String pull, String release) |
Bind command to trigger. More... | |
bool | bindStick (InputDevice device, InputDeviceAxisType type, int stick, String horizontal, String vertical, bool inverse) |
Bind command to joystick. More... | |
bool | bindStick (InputDevice device, InputDeviceAxisType type, int stick, String left, String right, String up, String down, bool inverse) |
Bind command to joystick. More... | |
void | removeAllDeviceBindings (InputDevice device) |
Remove all bindings for device. More... | |
Generate default bindings.
Helper for games running for the first time requiring a useful initial binding configuration the user can then adjust. The problem with initial binding configuration is that the user does not tap the keys for bindings but the game has to add some reasonable bindings for input devices it has little knowledge about. This class provides a simple way to achieve this goal. It uses the buttonMatchingKeyCode and buttonMatchingKeyChar methods to find suitable bindings.
Upon creating an instance of DefaultBindingHelper the present input devices are examine for typical candidates. The first found mouse, keyboard and gamepad type input device is stored. The user can then query the devices for some parameters for example how many buttons and axes a gamepad has if present. For each device the user can then add a binding using key code and/or key char. The first key matching the parameters is added. If required the user can examine the return value to learn if the binding has been assigned or not. This can be used to try a fallback assignment or trying a different layout altogether.
All changes are recorded in the DefaultBindingHelper instance. Once suitable the user can apply the changes to the binding manager.
bool Dragengine.Commands.DefaultBindingHelper.bindButton | ( | InputDevice | device, |
InputDeviceButtonType | type, | ||
int | button, | ||
String | command | ||
) |
Bind command to button on device.
device | Device containing axis. |
button | Index of button to bind. |
command | Name of command to bind. |
bool Dragengine.Commands.DefaultBindingHelper.bindButton | ( | InputDevice | device, |
int | button, | ||
String | command | ||
) |
Bind command to button on device.
device | Device containing axis. |
button | Index of button to bind. |
command | Name of command to bind. |
bool Dragengine.Commands.DefaultBindingHelper.bindStick | ( | InputDevice | device, |
InputDeviceAxisType | type, | ||
int | stick, | ||
String | horizontal, | ||
String | vertical, | ||
bool | inverse | ||
) |
Bind command to joystick.
type | Type of stick |
stick | Number of stick of given type. |
horizontal | Name of command to bind to horizontal movement or null. |
vertical | Name of command to bind to vertical movement or null. |
bool Dragengine.Commands.DefaultBindingHelper.bindStick | ( | InputDevice | device, |
InputDeviceAxisType | type, | ||
int | stick, | ||
String | left, | ||
String | right, | ||
String | up, | ||
String | down, | ||
bool | inverse | ||
) |
Bind command to joystick.
type | Type of stick. |
stick | Number of stick of given type. |
left | Name of command to bind to left movement or null. |
right | Name of command to bind to right movement or null. |
up | Name of command to bind to up movement or null. |
down | Name of command to bind to down movement or null. |
bool Dragengine.Commands.DefaultBindingHelper.bindTrigger | ( | InputDevice | device, |
InputDeviceAxisType | type, | ||
int | trigger, | ||
String | name | ||
) |
Bind command to trigger.
Device | device. |
type | Type of trigger. |
trigger | Number of trigger of given type. |
name | Name of command to bind to horizontal movement or null. |
bool Dragengine.Commands.DefaultBindingHelper.bindTrigger | ( | InputDevice | device, |
InputDeviceAxisType | type, | ||
int | trigger, | ||
String | pull, | ||
String | release | ||
) |
Bind command to trigger.
Device | device. |
type | Type of trigger. |
trigger | Number of trigger of given type. |
pull | Name of command to bind to pull movement or null. |
release | Name of command to bind to release movement or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindButton | ( | int | button, |
InputDeviceButtonType | type, | ||
String | command | ||
) |
Bind command to gamepad button.
button | Number of button starting with 0 for the first. |
type | Type of button. |
command | Name of command to bind to button or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindButton | ( | int | button, |
String | command | ||
) |
Bind command to gamepad button.
button | Number of button starting with 0 for the first. |
command | Name of command to bind to button or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindHat | ( | int | hat, |
String | horizontal, | ||
String | vertical | ||
) |
Bind command to gamepad hat or directional pad.
hat | Number of hat starting with 0 for the first. |
horizontal | Name of command to bind to left/right press or null. |
vertical | Name of command to bind to up/down press or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindHat | ( | int | hat, |
String | left, | ||
String | right, | ||
String | up, | ||
String | down | ||
) |
Bind command to gamepad hat or directional pad.
hat | Number of hat starting with 0 for the first. |
left | Name of command to bind to left press or null. |
right | Name of command to bind to right press or null. |
up | Name of command to bind to up press or null. |
down | Name of command to bind to down press or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindStick | ( | int | stick, |
String | horizontal, | ||
String | vertical | ||
) |
Bind command to gamepad stick.
stick | Number of stick starting with 0 for the first. |
horizontal | Name of command to bind to horizontal movement or null. |
vertical | Name of command to bind to vertical movement or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindStick | ( | int | stick, |
String | left, | ||
String | right, | ||
String | up, | ||
String | down | ||
) |
Bind command to gamepad stick.
stick | Number of stick starting with 0 for the first. |
left | Name of command to bind to left movement or null. |
right | Name of command to bind to right movement or null. |
up | Name of command to bind to up movement or null. |
down | Name of command to bind to down movement or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindTrigger | ( | int | trigger, |
String | command | ||
) |
Bind command to gamepad trigger.
trigger | Number of trigger starting with 0 for the first. |
command | Name of command to bind to horizontal movement or null. |
bool Dragengine.Commands.DefaultBindingHelper.gamepadBindTrigger | ( | int | trigger, |
String | pull, | ||
String | release | ||
) |
Bind command to gamepad trigger.
trigger | Number of trigger starting with 0 for the first. |
pull | Name of command to bind to pull or null. |
release | Name of command to bind to release or null. |
void Dragengine.Commands.DefaultBindingHelper.gamepadClear | ( | ) |
Remove all gamepad bindings.
Array Dragengine.Commands.DefaultBindingHelper.getAllVRHands | ( | bool | rightHand | ) |
All VR hand controller devices as Array of InputDevice.
rightHand | True for right hand controller otherwise left hand controller. |
BindingManager Dragengine.Commands.DefaultBindingHelper.getBindingManager | ( | ) |
Binding manager to update once finished.
CommandManager Dragengine.Commands.DefaultBindingHelper.getCommandManager | ( | ) |
Command manager to use for bindings.
InputDevice Dragengine.Commands.DefaultBindingHelper.getGamepad | ( | ) |
First gamepad device or null.
InputDevice Dragengine.Commands.DefaultBindingHelper.getKeyboard | ( | ) |
First keyboard device or null.
InputDevice Dragengine.Commands.DefaultBindingHelper.getVRHand | ( | bool | rightHand | ) |
First VR hand controller device or null.
rightHand | True for right hand controller otherwise left hand controller. |
bool Dragengine.Commands.DefaultBindingHelper.hasGamepad | ( | ) |
Gamepad device is present.
bool Dragengine.Commands.DefaultBindingHelper.hasKeyboard | ( | ) |
Keyboard device is present.
bool Dragengine.Commands.DefaultBindingHelper.hasVRHand | ( | bool | rightHand | ) |
One or more VR hand controller device is present.
rightHand | True to check right hand controller otherwise left hand controller. |
bool Dragengine.Commands.DefaultBindingHelper.keyboardBindCharacter | ( | int | character, |
InputEventKeyLocation | location, | ||
String | command | ||
) |
Bind command to keyboard key matching character.
Tries to find key matching character. If found binding is added. Supports distinguishing between duplicate keys in different locations like left and right shift key.
character | Character to find. |
location | Key location. |
command | Name of command to bind. |
bool Dragengine.Commands.DefaultBindingHelper.keyboardBindCharacter | ( | int | character, |
String | command | ||
) |
Bind command to keyboard key matching character.
Tries to find key matching character. If found binding is added.
character | Character to find. |
command | Name of command to bind. |
bool Dragengine.Commands.DefaultBindingHelper.keyboardBindKeyCode | ( | int | keyCode, |
InputEventKeyLocation | location, | ||
String | command | ||
) |
Bind command to keyboard key matching key code.
Tries to find key matching key code. If found binding is added. Supports distinguishing between duplicate keys in different locations like left and right shift key.
keyCode | Key code to find. |
location | Key location. |
command | Name of command to bind. |
bool Dragengine.Commands.DefaultBindingHelper.keyboardBindKeyCode | ( | int | keyCode, |
String | command | ||
) |
Bind command to keyboard key matching key code.
Tries to find key matching key code. If found binding is added.
keyCode | Key code to find. |
command | Name of command to bind. |
void Dragengine.Commands.DefaultBindingHelper.keyboardClear | ( | ) |
Remove all keyboard bindings.
bool Dragengine.Commands.DefaultBindingHelper.mouseBindAux | ( | int | number, |
String | command | ||
) |
Bind command to auxiliary mouse button.
These are buttons 4 upwards if present. Typically 4 is "browse forward" and 5 is "browse backward" but gaming mice can have any number of additional buttons with different usage. Auxiliary buttons are usually not present and tend to be unsuitable for an initial binding configuration.
number | Number of auxiliary button starting with 0 for the first. |
command | Name of command to bind to mouse button or null. |
bool Dragengine.Commands.DefaultBindingHelper.mouseBindLMR | ( | String | left, |
String | middle, | ||
String | right | ||
) |
Bind command to left, right and middle mouse buttons.
left | Name of command to bind to left mouse button or null. |
middle | Name of command to bind to middle mouse button or null. |
right | Name of command to bind to right mouse button or null. |
bool Dragengine.Commands.DefaultBindingHelper.mouseBindWheel | ( | int | wheel, |
String | command | ||
) |
Bind command to mouse wheel.
wheel | Number of wheel starting with 0 for the first wheel. |
command | Name of command to bind to mouse wheel or null. |
bool Dragengine.Commands.DefaultBindingHelper.mouseBindWheel | ( | int | wheel, |
String | up, | ||
String | down | ||
) |
Bind commands to mouse wheel.
wheel | Number of wheel starting with 0 for the first wheel. |
up | Name of command to bind to up mouse wheel movement or null. |
down | Name of command to bind to down mouse wheel movement or null. |
DefaultBindingHelper Dragengine.Commands.DefaultBindingHelper.new | ( | ) |
Create default binding helper using BaseGameApp.
Stores the first mouse, keyboard and gamepad device found for quick access.
DefaultBindingHelper Dragengine.Commands.DefaultBindingHelper.new | ( | BindingManager | bindingManager, |
CommandManager | commandManager | ||
) |
void Dragengine.Commands.DefaultBindingHelper.removeAllDeviceBindings | ( | InputDevice | device | ) |
Remove all bindings for device.
void Dragengine.Commands.DefaultBindingHelper.reset | ( | ) |
Remove all bindings.
void Dragengine.Commands.DefaultBindingHelper.updateBindingManager | ( | bool | clear | ) |
Update binding manager with found bindings.
clear | Removes first all bindings from binding manager. Set to false to add and overwrite found bindings leaving other bindings intact. |