Skip to content
SiteEmail

cohtml.InputSystem.GamepadMapper

Abstract class describing the Unity3D Input Manager gamepad mapping to the W3C standard gamepad mapping.

Inherits from cohtml.InputSystem.GamepadBase.GamepadMap

Inherited by cohtml.InputSystem.GamepadMapGeneric, cohtml.InputSystem.GamepadMapWinPS

Name
enum classProfile { PlayStation, XBox, Stadia, Other}
The supported gamepad mapping profiles. Add a new one or use Other
enum classPlatform { Unknown = 0, Windows, Mac, Linux, Android, IOS, Count}
Supported OS platforms. When a gamepad from another platform is present, it should be added here. The value Unknown should always be first, and Count should always remain last.
Name
enum classJSIndex { South = 0, LeftStickX = 0, East = 1, LeftStickY = 1, West = 2, RightStickX = 2, North = 3, RightStickY = 3, LeftBumper = 4, RightBumper = 5, LeftTrigger = 6, RightTrigger = 7, Select = 8, Start = 9, LeftStickPress = 10, RightStickPress = 11, DPadUp = 12, DPadDown = 13, DPadLeft = 14, DPadRight = 15, System = 16, Extra1 = 17, Extra2 = 18}
Buttons and Axes displayed in the correct order in the array according to the W3C standard. Each number corresponds to the index in the array.
Name
virtual voidUpdateEntities()
Updates the array of buttons and axes based on the mapping.
Name
GamepadMapper(uint id, string name, int buttonsLength =16, int axesLength =4)
stringMapButton(byte button)
stringMapAxis(byte axis)
virtual voidUpdateButtons()
Updates the array of buttons based on the mapping.
virtual voidUpdateDPad(string mapX, bool isInvertedX, string mapY, bool isInvertedY)
Most D-Pad buttons are mapped to 2 axes, but sometimes they are 4 buttons, sometimes are inverted axes, Provide a way to handle the buttons mapping.
virtual voidUpdateValue(float [] array, JSIndex jsIndex, float value)
A helper method used by all the above methods to update the value of provided array index.
Name
abstract ProfileProfileType
Name
const stringCohtmlGamepadStr
readonly stringCohtmlGamepadAxisName
readonly stringJoystickButtonName
Name
Dictionary< JSIndex, string >m_ButtonsMap
Dictionary< JSIndex, string >m_AxesMap
floatm_FloatValue
JSIndexm_JsIndex

Public Functions inherited from cohtml.InputSystem.GamepadBase.GamepadMap

Name
GamepadMap(uint id, string name, int buttonsLength, int axesLength)

Public Attributes inherited from cohtml.InputSystem.GamepadBase.GamepadMap

Name
uintId
The identification of the gamepad.
stringName
The name of the gamepad.
float []Buttons
An array representing the state of the gamepad buttons.
float []Axes
An array representing the state of the gamepad axes.
HashSet< CohtmlUISystem >RegisteredInSystems
A collection storing the CohtmlUISystem’s that registered this gamepad.
EnumeratorValueDescription
PlayStation
XBox
Stadia
Other

The supported gamepad mapping profiles. Add a new one or use Other

EnumeratorValueDescription
Unknown0
Windows
Mac
Linux
Android
IOS
Count

Supported OS platforms. When a gamepad from another platform is present, it should be added here. The value Unknown should always be first, and Count should always remain last.

EnumeratorValueDescription
South0
LeftStickX0
East1
LeftStickY1
West2
RightStickX2
North3
RightStickY3
LeftBumper4
RightBumper5
LeftTrigger6
RightTrigger7
Select8
Start9
LeftStickPress10
RightStickPress11
DPadUp12
DPadDown13
DPadLeft14
DPadRight15
System16
Extra117
Extra218

Buttons and Axes displayed in the correct order in the array according to the W3C standard. Each number corresponds to the index in the array.

virtual void UpdateEntities()

Updates the array of buttons and axes based on the mapping.

Reimplemented by: cohtml.InputSystem.GamepadMapWinPS.UpdateEntities

GamepadMapper(
uint id,
string name,
int buttonsLength =16,
int axesLength =4
)
string MapButton(
byte button
)
string MapAxis(
byte axis
)
virtual void UpdateButtons()

Updates the array of buttons based on the mapping.

virtual void UpdateDPad(
string mapX,
bool isInvertedX,
string mapY,
bool isInvertedY
)

Most D-Pad buttons are mapped to 2 axes, but sometimes they are 4 buttons, sometimes are inverted axes, Provide a way to handle the buttons mapping.

Parameters:

  • mapX Provide the horizontally mapping string
  • isInvertedX “Does it indicate whether the horizontal axis is inverted?”
  • mapY “Provide the vertically mapping string”
  • isInvertedY Does it indicate whether the vertical axis is inverted?
virtual void UpdateValue(
float [] array,
JSIndex jsIndex,
float value
)

A helper method used by all the above methods to update the value of provided array index.

abstract Profile ProfileType;
const string CohtmlGamepadStr = "Cohtml_Gamepad";
readonly string CohtmlGamepadAxisName;
readonly string JoystickButtonName;
Dictionary< JSIndex, string > m_ButtonsMap;
Dictionary< JSIndex, string > m_AxesMap;
float m_FloatValue;
JSIndex m_JsIndex;