cohtml.InputSystem.GamepadMapper
On this page
- Public Types
- Protected Types
- Public Functions
- Protected Functions
- Public Properties
- Public Attributes
- Protected Attributes
- Additional inherited members
- Public Types Documentation
- Protected Types Documentation
- Public Functions Documentation
- Protected Functions Documentation
- Public Property Documentation
- Public Attributes Documentation
- Protected Attributes Documentation
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
Public Types
Name | |
---|---|
enum class | Profile { PlayStation, XBox, Stadia, Other} The supported gamepad mapping profiles. Add a new one or use Other |
enum class | Platform { 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. |
Protected Types
Name | |
---|---|
enum class | JSIndex { 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. |
Public Functions
Name | |
---|---|
virtual void | UpdateEntities() Updates the array of buttons and axes based on the mapping. |
Protected Functions
Name | |
---|---|
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. |
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. |
Public Properties
Name | |
---|---|
abstract Profile | ProfileType |
Public Attributes
Name | |
---|---|
const string | CohtmlGamepadStr |
readonly string | CohtmlGamepadAxisName |
readonly string | JoystickButtonName |
Protected Attributes
Name | |
---|---|
Dictionary< JSIndex, string > | m_ButtonsMap |
Dictionary< JSIndex, string > | m_AxesMap |
float | m_FloatValue |
JSIndex | m_JsIndex |
Additional inherited members
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 | |
---|---|
uint | Id The identification of the gamepad. |
string | Name 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. |
Public Types Documentation
enum Profile
Enumerator | Value | Description |
---|---|---|
PlayStation | ||
XBox | ||
Stadia | ||
Other |
The supported gamepad mapping profiles. Add a new one or use Other
enum Platform
Enumerator | Value | Description |
---|---|---|
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.
Protected Types Documentation
enum JSIndex
Enumerator | Value | Description |
---|---|---|
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.
Public Functions Documentation
function UpdateEntities
virtual void UpdateEntities()
Updates the array of buttons and axes based on the mapping.
Reimplemented by: cohtml.InputSystem.GamepadMapWinPS.UpdateEntities
Protected Functions Documentation
function GamepadMapper
GamepadMapper(
uint id,
string name,
int buttonsLength =16,
int axesLength =4
)
function MapButton
string MapButton(
byte button
)
function MapAxis
string MapAxis(
byte axis
)
function UpdateButtons
virtual void UpdateButtons()
Updates the array of buttons based on the mapping.
function UpdateDPad
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?
function UpdateValue
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.
Public Property Documentation
property ProfileType
abstract Profile ProfileType;
Public Attributes Documentation
variable CohtmlGamepadStr
const string CohtmlGamepadStr = "Cohtml_Gamepad";
variable CohtmlGamepadAxisName
readonly string CohtmlGamepadAxisName;
variable JoystickButtonName
readonly string JoystickButtonName;
Protected Attributes Documentation
variable m_ButtonsMap
Dictionary< JSIndex, string > m_ButtonsMap;
variable m_AxesMap
Dictionary< JSIndex, string > m_AxesMap;
variable m_FloatValue
float m_FloatValue;
variable m_JsIndex
JSIndex m_JsIndex;