This page has been translated automatically.
Видеоуроки
Interface
Essentials
Advanced
Полезные советы
Программирование на C#
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Физика
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Настройки и предпочтения
Работа с проектами
Настройка параметров узла
Setting Up Materials
Setting Up Properties
Освещение
Landscape Tool
Sandworm (Experimental)
Использование инструментов редактора для конкретных задач
Extending Editor Functionality
Встроенные объекты
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Программирование
Основы
Настройка среды разработки
Примеры использования
UnigineScript
C++
C#
Унифицированный язык шейдеров UUSL
File Formats
Rebuilding the Engine Tools
GUI
Двойная точность координат
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
Работа с контентом
Оптимизация контента
Материалы
Art Samples
Tutorials
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::InputGamePad Class

Header: #include <UnigineInput.h>

The InputGamePad class represents a game pad and contains a set of functions for handling user inputs.

InputGamePad Class

Enums

BUTTON#

NameDescription
BUTTON_A = 0Button A.
BUTTON_B = 1Button B.
BUTTON_X = 2Button X.
BUTTON_Y = 3Button Y.
BUTTON_BACK = 4Button "Back".
BUTTON_START = 5Button "Start".
BUTTON_DPAD_UP = 6Button "Up".
BUTTON_DPAD_DOWN = 7Button "Down".
BUTTON_DPAD_LEFT = 8Button "Left".
BUTTON_DPAD_RIGHT = 9Button "Right".
BUTTON_THUMB_LEFT = 10Left thumbstick button.
BUTTON_THUMB_RIGHT = 11Right thumbstick button.
BUTTON_SHOULDER_LEFT = 12Left shoulder (bumper) button.
BUTTON_SHOULDER_RIGHT = 13Right shoulder (bumper) button.
NUM_BUTTONS = 14Number of buttons on a game pad.

Members


int getNumber ( ) #

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

Return value

Game pad number.

const char * getName ( ) #

Returns the name of the game pad.

Return value

One of the following:
  • GamePad
  • Wheel
  • Arcade Stick
  • Flight Stick
  • Dance Pad
  • Guitar
  • Drum Kit
  • Unknown

void setFilter ( float filter ) #

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.

Arguments

  • float filter - 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.

float getFilter ( ) #

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.

Return value

The filter of the gamepad.

Math::vec2 getAxesLeft ( ) #

Returns a vector of axes of the left thumbstick. When a thumbstick is in the center position, this value is [0,0]. The values correspond to the following thumbstick positions:
  • First value corresponds to the X axis. Negative values indicate the left position; positive values indicate right.
  • Second value corresponds to the Y axis. Negative values indicate the down position; positive values indicate up.

Return value

A vector of two values in the [-1;1] range.

Math::vec2 getAxesLeftDelta ( ) #

Returns a vector of delta values of the left thumbstick axes — the difference between the values in the previous and the current frames.

Return value

Vector of delta axes.

Math::vec2 getAxesRight ( ) #

Returns a vector of axes of the right thumbstick. When a thumbstick is in the center position, this value is [0,0]. The values correspond to the following thumbstick positions:
  • First value corresponds to the X axis. Negative values indicate the left position; positive values indicate right.
  • Second value corresponds to the Y axis. Negative values indicate the down position; positive values indicate up.

Return value

A vector of two values in the [-1;1] range.

Math::vec2 getAxesRightDelta ( ) #

Returns a vector of delta values of the right thumbstick axes — the difference between the values in the previous and the current frames.

Return value

Vector of delta axes.

float getTriggerLeft ( ) #

Returns an axis state value (the position) of the left trigger. 0 means the trigger is not pressed; 1 means the trigger is pressed to the maximum.

Return value

Value in range [0; 1].

float getTriggerLeftDelta ( ) #

Returns the delta value of the left trigger — the difference between the values in the previous and the current frame.

Return value

Left trigger delta.

float getTriggerRight ( ) #

Returns an axis state value (the position) of the right trigger. 0 means the trigger is not pressed; 1 means the trigger is pressed to the maximum.

Return value

Value in range [0; 1].

float getTriggerRightDelta ( ) #

Returns the delta value of the right trigger — the difference between the values in the previous and the current frame.

Return value

Right trigger delta.

void setLeftMotor ( float speed ) #

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

Arguments

  • float speed - value in the [0.0f; 1.0f] range.

void setRightMotor ( float speed ) #

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

Arguments

  • float speed - value in the [0.0f; 1.0f] range.

int isAvailable ( ) #

Checks if the game pad is available.

Return value

1 if the game pad is available; otherwise, 0.

int isButtonPressed ( int button ) #

Returns a value indicating if the given button is pressed.

Arguments

  • int button - One of the preset BUTTON_ codes.

Return value

1 if the button is pressed; otherwise, 0.

int isButtonDown ( int button ) #

Returns a value indicating if the given button was pressed during the current frame.

Arguments

  • int button - One of the preset BUTTON_ codes.

Return value

1 if the button was pressed during the current frame; otherwise, 0.

int isButtonUp ( int button ) #

Returns a value indicating if the given button was released during the current frame.

Arguments

  • int button - One of the preset BUTTON_ codes.

Return value

1 if the button was released during the current frame; otherwise, 0.
Last update: 24.11.2020
Build: ()