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.ControlsXPad360 Class

Inherits from: Controls

ControlsXPad360 Class

Properties

float Filter#

A filter value used to correct the current state of the analog axis (thumbsticks and triggers) relative to the previous one:
  • Filter value of 0 means there is no interpolation and the current value is not corrected.
  • Filter value of 1 means the previous state is used instead of the current one.
set
Sets a filter value used to correct the current state of the analog axis relative to the previous one. Axis states are interpolated for thumbsticks and triggers.
set value - Filter value for interpolation between axis states. The provided value is clamped to a range [0;1].
  • Filter value of 0 means there is no interpolation and the current value is not corrected.
  • Filter value of 1 means the previous state is used instead of the current one.

string Name#

The name of the game pad.

bool IsAvailable#

Checks if the game pad is available.

int Number#

The game pad number (up to four game pads are supported).

bool IsStateEvent#

A value indicating if a game pad button is successfully assigned to a state.

float RightTrigger#

An axis state value (the position) of the right trigger. zero means the trigger is not pressed; 1 means the trigger is pressed to the maximum.

float LeftTrigger#

An axis state value (the position) of the left trigger. zero means the trigger is not pressed; 1 means the trigger is pressed to the maximum.

float RightY#

A state value of the right thumbstick along the Y axis. When a thumbstick is in the center position, this value is zero. Negative values indicate down; positive values indicate up.

float RightX#

A state value of the right thumbstick along the X axis. When a thumbstick is in the center position, this value is zero. Negative values indicate left; positive values indicate right.

float LeftY#

A state value of the left thumbstick along the Y axis. When a thumbstick is in the center position, this value is zero. Negative values indicate down; positive values indicate up.

float LeftX#

A state value of the left thumbstick along the X axis. When a thumbstick is in the center position, this value is zero. Negative values indicate left; positive values indicate right.

Members


ControlsXPad360 ( int num ) #

Constructor. Creates a new XBox 360 game pad.

Arguments

  • int num - Game pad number (up to four game pads are supported).

int GetButton ( int button ) #

Returns a button state (pressed or not pressed).

Arguments

Return value

1 if the button is pressed; otherwise, 0.

void SetLeftMotor ( float speed ) #

Sets the amount of vibration for the left motor (a low-frequency motor).

Arguments

  • float speed - Speed of motor rotation in range [0; 1].

void SetRightMotor ( float speed ) #

Sets the amount of vibration for the right motor (a high-frequency motor).

Arguments

  • float speed - Speed of motor rotation in range [0; 1].

void SetStateButton ( int state, int button ) #

Sets a game pad button that switches a given state on and off.

Arguments

int GetStateButton ( int state ) #

Returns a game pad button that switches a given state on and off.

Arguments

Return value

Button that switches the state (one of the CONTROLS_XPAD360_BUTTON_* variables):
  1. BUTTON_A = 0
  2. BUTTON_B
  3. BUTTON_X
  4. BUTTON_Y
  5. BUTTON_BACK
  6. BUTTON_START
  7. BUTTON_DPAD_UP
  8. BUTTON_DPAD_DOWN
  9. BUTTON_DPAD_LEFT
  10. BUTTON_DPAD_RIGHT
  11. BUTTON_THUMB_LEFT
  12. BUTTON_THUMB_RIGHT
  13. BUTTON_SHOULDER_LEFT
  14. BUTTON_SHOULDER_RIGHT

void GetStateEvent ( int state ) #

Lets the user assign a game pad button to a given state.

Arguments

  • int state - State (one of the CONTROLS_STATE_* variables), to which a button is going to be assigned.

int IsStateEvent ( ) #

Returns a value indicating if a game pad button is successfully assigned to a state.

Return value

1 if a button is already assigned; otherwise, 0.

string GetStateName ( int state ) #

Returns the name of a given state.

Arguments

Return value

State name.

int ClearButton ( int button ) #

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

Arguments

Return value

1 if the button is pressed, and this function was not called previously in the current frame; otherwise, 0.

bool SaveState ( Stream stream ) #

Saves XBox 360 game pad settings into the stream.

Example using saveState() and restoreState() methods:

Source code (C#)
// initialize a node and set its state
ControlsXPad360 xpad = new ControlsXPad360(1);
xpad.SetStateButton(0,1);

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

// change the node state
xpad.SetStateButton(2,1);

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

Arguments

  • Stream stream - The stream to save controls data.

Return value

true if the XBox 360 game pad settings are saved successfully; otherwise, false.

bool RestoreState ( Stream stream ) #

Restores XBox 360 game pad settings from the stream.

Example using saveState() and restoreState() methods:

Source code (C#)
// initialize a node and set its state
ControlsXPad360 xpad = new ControlsXPad360(1);
xpad.SetStateButton(0,1);

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

// change the node state
xpad.SetStateButton(2,1);

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

Arguments

  • Stream stream - The stream to save controls data.

Return value

true if the XBox 360 game pad settings are restored successfully; otherwise, false.

int UpdateEvents ( ) #

Scans a game pad (synchronizes states of game pad buttons and thumbsticks with the controller itself). Should be called each frame.

Return value

0 if a game pad is not found or updateEvents() already has been called for the frame; otherwise 1.
Last update: 2021-04-29
Build: ()