This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::Controls Class

Interface for controls handling.

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

Unigine::Controls Class

Members


virtual ~Controls ()

Virtual destructor.

static Ptr< Controls > get ()

Returns a pointer to the Controls.

Return value

Pointer to the Controls.

static Ptr< Controls > create ()

Controls constructor.

Return value

Pointer to the created controls.

virtual void grab () =0

Sets the "owner" flag to 1 for the pointer. The Controls should not be handled by the engine after this function is called.

virtual void release () =0

Sets the "owner" flag to 0 for the pointer. The Controls should be handled by the engine after this function is called.

virtual int isOwner () const =0

Returns the "owner" flag. If the pointer is the owner, on its deletion the object also will be deleted. Use grab() and release() functions to change ownership.

Return value

The "owner" flag.

virtual void setMouseDX (float dx) const =0

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

Arguments

  • float dx - Change of the X coordinate.

virtual void setMouseDY (float dy) const =0

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

Arguments

  • float dy - Change of the Y coordinate.

virtual float getMouseDX () const =0

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

Return value

Change of the X coordinate.

virtual float getMouseDY () const =0

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

Return value

Change of the Y coordinate.

virtual void setState (int state, int value) const =0

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.

virtual int getState (int state) const =0

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.

virtual int clearState (int state) const =0

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.

Unigine::Controls::anonymous_5 Enumeration

STATE_FORWARD = 0
STATE_BACKWARD
STATE_MOVE_LEFT
STATE_MOVE_RIGHT
STATE_TURN_UP
STATE_TURN_DOWN
STATE_TURN_LEFT
STATE_TURN_RIGHT
STATE_CROUCH
STATE_JUMP
STATE_RUN
STATE_USE
STATE_FIRE
STATE_SAVE
STATE_RESTORE
STATE_SCREENSHOT
STATE_AUX_0
STATE_AUX_1
STATE_AUX_2
STATE_AUX_3
STATE_AUX_4
STATE_AUX_5
STATE_AUX_6
STATE_AUX_7
STATE_AUX_8
STATE_AUX_9
STATE_AUX_A
STATE_AUX_B
STATE_AUX_C
STATE_AUX_D
STATE_AUX_E
STATE_AUX_F
NUM_STATES
Last update: 2017-07-03
Build: ()