This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Pathfinding-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

ControlsApp Class

This class handles input from the current application window.

ControlsApp Class

Members


int getStateKey (int state)

Returns a key that toggles a given state on and off.

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

const char * 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.

float getMouseSensitivity ()

Returns the current mouse sensitivity used to increase or decrease the speed of mouse movement.

Return value

Mouse sensitivity.

int isStateButton (int button)

Arguments

  • int button

Return value

void setStateButton (int state, int button)

Arguments

  • int state
  • int button

void setStateKey (int state, int key)

Arguments

  • int state
  • int key

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.

void setAlwaysRun (int run)

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 run - Positive integer to make the player run by default; otherwise, 0.

void setMouseEnabled (int enabled)

Enables or disables the mouse input.

Arguments

  • int enabled - Positive integer to enable the mouse; 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.

int getStateButton (int state)

Returns a mouse button that switches a given state on and off.

Arguments

Return value

Button that toggles the state (one of APP_BUTTON_* variables):
  1. APP_BUTTON_LEFT = 1 << 0
  2. APP_BUTTON_MIDDLE
  3. APP_BUTTON_RIGHT
  4. APP_BUTTON_DCLICK
  5. APP_BUTTON_AUX_0
  6. APP_BUTTON_AUX_1
  7. APP_BUTTON_AUX_2
  8. APP_BUTTON_AUX_3

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 getState (int state)

Arguments

  • int state

Return value

float getMouseDY ()

Return value

int clearState (int state)

Arguments

  • int state

Return value

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.

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.

void setState (int state, int value)

Arguments

  • int state
  • int value

void setMouseInverse (int inverse)

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.

Arguments

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

Arguments

  • float sensitivity - Mouse sensitivity. Higher values increase the mouse speed; lower values decrease it.

float getMouseDX ()

Return value

void setMouseDX (float mousedx)

Arguments

  • float mousedx

void setMouseDY (float mousedy)

Arguments

  • float mousedy
Last update: 03.07.2017
Build: ()