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
Bounds-Related Classes
Containers
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes

Unigine::Controls Class

Interface for controls handling.

To use this class, include the UnigineControls.h file.

Controls Class

Members


Controls (int type)

Arguments

  • int type

float getMouseDY ()

Returns a screen position change of the mouse pointer along the Y axis during the last frame.

Return value

Change of the Y coordinate.

int clearState (int state)

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

Arguments

  • int state - Control state number. Possible values are in range [STATE_FORWARD;NUM_STATES]. For full list of available controls see Unigine::Controls:: Enumeration at the end of the article.

Return value

Returns the state of the given control: 1 if the control is pressed; otherwise,0.

float getMouseDX ()

Returns a screen position change of the mouse pointer along the X axis during the last frame.

Return value

Change of the X coordinate.

Ptr<Controls> getControls ()

Return value

const char * getTypeName ()

Returns a type name of input controls.

Return value

Type name.

int getType ()

Returns the type of input controls.

Return value

Controls type (one of CONTROLS_* variables):
  1. CONTROLS_APP = 0
  2. CONTROLS_DUMMY
  3. CONTROLS_SIXAXIS
  4. CONTROLS_XPAD360
  5. CONTROLS_JOYSTICK

void setMouseDX (float mousedx)

Updates a screen position change of the mouse pointer along the X axis.

Arguments

  • float mousedx - Change of the X coordinate.

int restoreState (const Ptr<Stream> & stream)

Arguments

  • const Ptr<Stream> & stream

Return value

int saveState (const Ptr<Stream> & stream)

Arguments

  • const Ptr<Stream> & stream

Return value

void setState (int state, int value)

Updates the state of a given control (i.e. 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:: Enumeration at the end of the article.
  • int value - State value: positive value to "press" the control; 0 to release it.

void setMouseDY (float mousedy)

Updates a screen position change of the mouse pointer along the Y axis.

Arguments

  • float mousedy - Change of the Y coordinate.

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:: Enumeration at the end of the article.

Return value

Returns the state of the given control.

int CONTROLS_APP

Description

A ControlsApp instance.

int CONTROLS_DUMMY

Description

ControlsDummy instance.

int CONTROLS_SIXAXIS

Description

Sixaxis controller as the input device.

int CONTROLS_XPAD360

Description

XBox 360 game pad as the input device.

int CONTROLS_JOYSTICK

Description

Joystick as the input device.

int STATE_FORWARD

Description

A state in which the player moves forwards.

int STATE_BACKWARD

Description

A state in which the player moves backwards.

int STATE_MOVE_LEFT

Description

A state in which the player moves left.

int STATE_MOVE_RIGHT

Description

A state in which the player moves right.

int STATE_TURN_UP

Description

A state, in which the player turns upward.

int STATE_TURN_DOWN

Description

A state in which the player turns downward.

int STATE_TURN_LEFT

Description

A state in which the player turns left.

int STATE_TURN_RIGHT

Description

A state in which the player turns right.

int STATE_CROUCH

Description

A state in which the player crouches or squats.

int STATE_JUMP

Description

A state in which the player jumps.

int STATE_RUN

Description

A state in which the player runs.

int STATE_USE

Description

A state in which the player utilizes some object.

int STATE_FIRE

Description

A state in which the player fires their weapon.

int STATE_SAVE

Description

A state in which the world is being saved.

int STATE_RESTORE

Description

A state in which the world is being restored.

int STATE_SCREENSHOT

Description

A state in which a screenshot is being taken.

int STATE_AUX_0

Description

Auxiliary state (unreserved) It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_1

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_2

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_3

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_4

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_5

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_6

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_7

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_8

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_9

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_A

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_B

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_C

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_D

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_E

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int STATE_AUX_F

Description

Auxiliary state (unreserved). It can be mapped to any control state, if necessary (see the example).

int NUM_STATES

Description

The total number of controls states.
Last update: 2017-07-03