This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.ControlsApp Class

This class handles input from the current application window.

See Also#

ControlsApp Class

Properties

float MouseDY#

A screen position change of the mouse pointer along the y axis during the last frame.
set
Updates a screen position change of the mouse pointer along the Y axis.
set value - Change of the Y coordinate.

float MouseDX#

A screen position change of the mouse pointer along the x axis during the last frame.
set
Updates a screen position change of the mouse pointer along the X axis.
set value - Change of the X coordinate.

float MouseSensitivity#

The current mouse sensitivity used to increase or decrease the speed of mouse movement. This parameter is stored in the following configuration file: *.controls.
set
Sets mouse sensitivity used to increase or decrease the speed of mouse movement.
set value - Mouse sensitivity. Higher values increase the mouse speed; lower values decrease it.

int MouseInverse#

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. This parameter is stored in the following configuration file: *.controls.
set
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.
set value - Positive integer to inverse the mouse; otherwise, 0.

bool MouseEnabled#

A value indicating if the mouse is enabled.
set
Enables or disables the mouse input.
set value - Positive integer to enable the mouse; otherwise, 0.

int AlwaysRun#

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. This parameter is stored in the following configuration file: *.controls.
set
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.
set value - Positive integer to make the player run by default; otherwise, 0.

bool Enabled#

A value indicating if input handling for current application window is enabled.
set
Enables or disables input handling for current application window.
set value - true to enable input handling for current application window, false to disable it.

Input.MOUSE_HANDLE MouseHandle#

Returns the mouse behavior mode. This parameter is stored in the following configuration file: *.controls.
set
Sets the mouse behavior mode.
set value - Mouse behavior mode, one of the MOUSE_HANDLE values.

bool Autosave#

Console: controls_config_autosave
A 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. This parameter is stored in the following configuration file: *.controls.
set
Sets a value indicating if current controls configuration settings are automatically saved to the corresponding config file on loading, closing, and saving the world, as well as on the Engine shutdown.
set value - true to enable automatic saving of current controls configuration settings; false — to disable it.

string Path#

Console: controls_config
The current path to the controls configuration file (default: configs/default.controls). This parameter is stored in the following configuration file: *.boot.
set
Sets a new 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.
set value - New path to the controls configuration file to be set.

Members


void SetState ( int state, int value ) #

Updates the state of a given control (sets the control on or off).

Arguments

  • int state - Control state number to update. Possible values are in range [STATE_FORWARD;NUM_STATES]. For full list of available controls see Unigine::Controls
  • 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 - Control state number. Possible values are in range [STATE_FORWARD;NUM_STATES]. For full list of available controls see Unigine::Controls

Return value

State value: positive value means the control is "pressed"; 0 means the control is released.

void SetStateButton ( int state, int button ) #

Sets a mouse button that switches a given state on and off. This parameter is stored in the following configuration file: *.controls.

Arguments

int GetStateButton ( int state ) #

Returns a mouse button that switches a given state on and off. This parameter is stored in the following configuration file: *.controls.

Arguments

Return value

Button that toggles the state (one of APP_BUTTON_* variables).

int IsStateButton ( int button ) #

Returns a value indicating if the given button assigned to the state.

Arguments

  • int button - Button that toggles the state (one of APP_BUTTON_* variables).

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 the CONTROLS_STATE_* variables), to which a key or a mouse button is going to be assigned.

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, int key ) #

Sets a key that toggles a given state on and off. This parameter is stored in the following configuration file: *.controls.

Arguments

  • int state - State (one of CONTROLS_STATE_* variables).
  • int key - Key that switches the state. It is a standard ASCII key code or one of the APP_KEY_* variables.

int GetStateKey ( int state ) #

Returns a key that toggles a given state on and off. This parameter is stored in the following configuration file: *.controls.

Arguments

Return value

Key that switches the state. It is a standard ASCII key code or one of the APP_KEY_* variables:
  1. KEY_ESC = 256
  2. KEY_TAB
  3. KEY_BACKSPACE
  4. KEY_RETURN
  5. KEY_DELETE
  6. KEY_INSERT
  7. KEY_HOME
  8. KEY_END
  9. KEY_PGUP
  10. KEY_PGDOWN
  11. KEY_LEFT
  12. KEY_RIGHT
  13. KEY_UP
  14. KEY_DOWN
  15. KEY_SHIFT
  16. KEY_CTRL
  17. KEY_ALT
  18. KEY_SCROLL
  19. KEY_CAPS
  20. KEY_NUM
  21. KEY_F1
  22. KEY_F2
  23. KEY_F3
  24. KEY_F4
  25. KEY_F5
  26. KEY_F6
  27. KEY_F7
  28. KEY_F8
  29. KEY_F9
  30. KEY_F10
  31. KEY_F11
  32. KEY_F12

int IsStateKey ( int 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

  • int key - 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.

string GetStateName ( int state ) #

Returns the name of the given control state.

Arguments

  • int state - The control state number in range from 0 to the total number of states.

Return value

Name of the given control state.

int ClearState ( int state ) #

Returns a control state and clears it to 0 (control is not pressed).

Arguments

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: 2021-04-29
Build: ()