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

Public Types

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.

Protected Types

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.

Public Functions

Name
virtual voidUpdateEntities()
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)
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.

Public Properties

Name
abstract ProfileProfileType

Public Attributes

Name
const stringCohtmlGamepadStr
readonly stringCohtmlGamepadAxisName
readonly stringJoystickButtonName

Protected Attributes

Name
Dictionary< JSIndex, string >m_ButtonsMap
Dictionary< JSIndex, string >m_AxesMap
floatm_FloatValue
JSIndexm_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
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.

Public Types Documentation

enum Profile

EnumeratorValueDescription
PlayStation
XBox
Stadia
Other

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

enum Platform

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.

Protected Types Documentation

enum JSIndex

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.

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;