This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine.Controls Class

Notice
This class is deprecated. Use Input class instead.

Controls Class

枚举

TYPE#

Name描述
CONTROLS_APP = 0ControlsApp instance.
CONTROLS_DUMMY = 1ControlsDummy instance.

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.

string TypeName#

The type name of input controls.

Controls.TYPE Type#

The type of input controls.

Members


Controls ( int type ) #

Creates a smart pointer to Controls.

Arguments

  • int type - Type of the controls to be created.

void SetState ( int state, int value ) #

Toggles the state of the given control on or off.

Arguments

  • int state - State (one of CONTROLS_STATE_* variables).
  • int value - Positive value to "press" the corresponding control; 0 to release it.

int GetState ( int state ) #

Returns the state of a given control (pressed or unpressed).

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.

Return value

1 if the control is pressed; otherwise, 0.

int GetStateByName ( string name ) #

Returns the state of a given control (pressed or unpressed) by the control state name.

Arguments

  • string name - Name of the control state. For full list of available controls see Unigine::Controls:: Enumeration.

Return value

1 if the control is pressed; otherwise, 0.

string GetStateName ( int state ) #

Returns the name of a given control state as a string.

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.

Return value

Name of the control state.

int ClearState ( int state ) #

Returns a control state and clears it to 0 (not pressed). This function allows to handle control only once even if it is kept pressed over several frames.

Arguments

Return value

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

bool SaveState ( Stream stream ) #

Saves controls settings into the stream.

Example using saveState() and restoreState() methods:

Source code (C#)
// Get the instance of default engine controls and set its state
Controls controls = new engine.Controls();
controls.MouseDX = 5.0f;

// save state
Blob blob_state = new Blob();
controls.SaveState(blob_state);

// change the node state
controls.MouseDX = 1.0f;

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
controls.RestoreState(blob_state);

Arguments

  • Stream stream - The stream to save controls data.

Return value

true if the controls settings are saved successfully; otherwise, false.

bool RestoreState ( Stream stream ) #

Restores controls settings from the stream.

Example using saveState() and restoreState() methods:

Source code (C#)
// Get the instance of default engine controls and set its state
Controls controls = new engine.Controls();
controls.MouseDX = 5.0f;

// save state
Blob blob_state = new Blob();
controls.SaveState(blob_state);

// change the node state
controls.MouseDX = 1.0f;

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
controls.RestoreState(blob_state);

Arguments

  • Stream stream - The stream to save controls data.

Return value

true if the controls settings are restored successfully; otherwise, false.

The information on this page is valid for UNIGINE 2.19.1 SDK.

Last update: 2025-03-11
Build: ()