Unigine.ControlsApp Class
This class handles input from the current application window.
See Also#
- The Basic Object Movements usage example demonstrating how to set control keys
ControlsApp Class
Properties
float MouseDY#
The screen position change of the mouse pointer along the y axis during the previous frame.
float MouseDX#
The screen position change of the mouse pointer along the x axis during the previous frame.
float MouseSensitivity#
The mouse sensitivity used to increase or decrease the speed of mouse movement.
bool MouseInverse#
The 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.
bool MouseRawInput#
The value indicating which type of mouse data is used to control the camera — raw (Input::getMouseDeltaRaw()) or processed by the OS (Input::getMouseDeltaPosition()).
bool MouseEnabled#
The value indicating if the mouse is enabled.
int AlwaysRun#
The value indicating if the player is running by default. If the player is in this mode, the Run control will switch them to walking. A positive integer enables this mode, 0 disables it.
bool Enabled#
The value indicating if input handling for current application window is enabled.
Input.MOUSE_HANDLE MouseHandle#
The mouse behavior mode.
bool Autosave#
The value indicating if current controls configuration settings are automatically saved to the corresponding controls config file (configs/default.controls by default) on loading, closing, and saving the world, as well as on the Engine shutdown.
string Path#
The path to the controls configuration file (default: configs/default.controls). The path can be specified as an absolute path or relative to the -data_path or <project_name> folder if the -project_name is set.
Input.KEY RemoveGrabKey#
The key used to switch off the grab mode of the mouse pointer (mouse pointer is bound to the application window). See this example for more information on mouse pointer modes and customization.
Members
void SetState ( int state, int value ) #
Updates the state of a given control (sets the control on or off).Arguments
- int state - State (one of STATE_* variables).
- int value - State value: positive value to "press" the control; 0 to release it.
int GetState ( int state ) #
Returns the state of a given control.Arguments
- int state - State (one of STATE_* variables).
Return value
State value: positive value means the control is "pressed"; 0 means the control is released.void SetStateMouseButton ( int state, Input.MOUSE_BUTTON button ) #
Sets a mouse button that switches a given state on and off. This parameter is stored in the following configuration file:Arguments
- int state - State (one of STATE_* variables).
- Input.MOUSE_BUTTON button - Button that toggles the state, one of the Input.MOUSE_BUTTON enum values.
Input.MOUSE_BUTTON GetStateMouseButton ( int state ) #
Returns a mouse button that switches a given state on and off. This parameter is stored in the following configuration file:Arguments
- int state - State (one of STATE_* variables).
Return value
Button that toggles the state, one of the Input.MOUSE_BUTTON enum values.int IsStateMouseButton ( Input.MOUSE_BUTTON button ) #
Returns a value indicating if the given button assigned to the state.Arguments
- Input.MOUSE_BUTTON button - Button that toggles the state, one of the Input.MOUSE_BUTTON enum values.
Return value
1 if the given button is assigned; otherwise, 0.void GetStateEvent ( int state ) #
Lets the user assign a key or a mouse button to a given state.Arguments
- int state - State (one of STATE_* variables).
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.void SetStateKey ( int state, Input.KEY key ) #
Sets a key that toggles a given state on and off. This parameter is stored in the following configuration file:Arguments
- int state - State (one of STATE_* variables).
- Input.KEY key - Key that switches the state, one of the Input.KEY enum values.
Input.KEY GetStateKey ( int state ) #
Returns a key that toggles a given state on and off. This parameter is stored in the following configuration file:Arguments
- int state - State (one of STATE_* variables).
Return value
Key that switches the state, one of the Input.KEY enum values.int IsStateKey ( Input.KEY key ) #
Checks if a given key already acts as an application control. This is useful to avoid collisions between application controls and hot keys.Arguments
Return value
1 if the key is assigned to a state; otherwise, 0.string GetStateName ( int state ) #
Returns the name of the given control state.Arguments
- int state - State (one of STATE_* variables).
Return value
Name of the given control state.string GetStateInfo ( int state ) #
Returns the information about the given control state.Arguments
- int state - State (one of STATE_* variables).
Return value
String containing information about the given control state.int ClearState ( int state ) #
Returns a control state and clears it to 0 (control is not pressed).Arguments
- int state - State (one of STATE_* variables).
Return value
1 if the control is pressed; otherwise, 0.int Load ( ) #
Console: controls_config_load
Loads controls configuration settings from a controls configuration file (configs/default.controls by default). To change the path to the controls configuration file use the setPath() method.Return value
1 if controls configuration settings are successfully loaded from a file; otherwise, 0.int Save ( ) #
Console: controls_config_save
Saves controls configuration settings to a controls configuration file (configs/default.controls by default). To change the path to the controls configuration file use the setPath() method.Return value
1 if controls configuration settings are successfully saved to a file; otherwise, 0.Last update:
2024-10-09
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)