ControlsApp Class
This class handles input from the current application window.
ControlsApp Class
This class inherits from ControlsMembers
int getAlwaysRun ()
Returns a value indicating if the player is running by default. If the player is in this mode, the Run control will switch them to walking.Return value
1 if the player is running by default; otherwise, 0.int getMouseInverse ()
Returns a value indicating if back-and-forth movements of the mouse (by Y-axis) are inverted: when the mouse is moved upward, the camera looks downwards, and when the mouse is moved downwards, the camera looks upwards. This mode is available only to control the camera.Return value
1 if the mouse is inverted; otherwise, 0.float getMouseSensitivity ()
Returns the current mouse sensitivity used to increase or decrease the speed of mouse movement.Return value
Mouse sensitivity.int getStateButton (int state)
Returns a mouse button that switches a given state on and off.Arguments
- int state - State (one of CONTROLS_STATE_* variables).
Return value
Button that toggles the state (one of APP_BUTTON_* variables):- APP_BUTTON_LEFT = 1 << 0
- APP_BUTTON_MIDDLE
- APP_BUTTON_RIGHT
- APP_BUTTON_DCLICK
- APP_BUTTON_AUX_0
- APP_BUTTON_AUX_1
- APP_BUTTON_AUX_2
- APP_BUTTON_AUX_3
void getStateEvent (int state)
Lets the user assign a key or a mouse button to a given state.Arguments
- int state - State (one of the CONTROLS_STATE_* variables), to which a key or a mouse button is going to be assigned.
int getStateKey (int state)
Returns a key that toggles a given state on and off.Arguments
- int state - State (one of CONTROLS_STATE_* variables).
Return value
Key that switches the state. It is a standard ASCII key code or one of the APP_KEY_* variables:- KEY_ESC = 256
- KEY_TAB
- KEY_BACKSPACE
- KEY_RETURN
- KEY_DELETE
- KEY_INSERT
- KEY_HOME
- KEY_END
- KEY_PGUP
- KEY_PGDOWN
- KEY_LEFT
- KEY_RIGHT
- KEY_UP
- KEY_DOWN
- KEY_SHIFT
- KEY_CTRL
- KEY_ALT
- KEY_SCROLL
- KEY_CAPS
- KEY_NUM
- KEY_F1
- KEY_F2
- KEY_F3
- KEY_F4
- KEY_F5
- KEY_F6
- KEY_F7
- KEY_F8
- KEY_F9
- KEY_F10
- KEY_F11
- KEY_F12
string getStateName (int state)
Returns the name of a given state, that was assigned to one of controls.Arguments
- int state - State (one of CONTROLS_STATE_* variables).
Return value
State name ("key KEY_NAME" or "button BUTTON_NAME").int isMouseEnabled ()
Returns a value indicating if the mouse is enabled.Return value
1 if the mouse is enabled; otherwise, 0.int isStateEvent ()
Returns a value indicating if a key or a mouse button is successfully assigned to a state.Return value
1 if a key or a mouse button is already assigned; otherwise, 0.int isStateKey (int keycode)
Checks if a given key already acts as an application control. This is useful to avoid collisions between application controls and hot keys.Arguments
- int keycode - Key in one of the following formats:
- Character format (for example, 'a')
- Standard ASCII key code (for example, 97)
- One of APP_KEY_* variables
Return value
1 if the key is assigned to a state; otherwise, 0.void setAlwaysRun (int mode)
Sets a value indicating if the player is running by default. If the player is in this mode, the Run control will switch them to walking. The default is 0.Arguments
- int mode - Positive integer to make the player run by default; otherwise, 0.
void setMouseEnabled (int mode)
Enables or disables the mouse input. The default is 0.Arguments
- int mode - Positive integer to enable the mouse; otherwise, 0.
void setMouseInverse (int mode)
Sets back-and-forth movements of the mouse (by Y-axis) to be interpreted as inverted: when the mouse is moved upward, the camera looks downwards, and when the mouse is moved downwards, the camera looks upwards. This mode is available only to control the camera. The default is 0.Arguments
- int mode - Positive integer to inverse the mouse; otherwise, 0.
void setMouseSensitivity (float sensitivity)
Sets mouse sensitivity used to increase or decrease the speed of mouse movement. The default is 1.Arguments
- float sensitivity - Mouse sensitivity. Higher values increase the mouse speed; lower values decrease it.
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)