Common Organization of Controls Kit Fields
Control object have a variety of fields that you can directly access.
Basics
Control objects' structure is defined as following:
- defaultOption
- defaultLayout
- current
- previous
- joysticks
- name
- number
- etc
- id
- mouse
- x
- y
- fx
- fy
Details
string defaultOption
- Option to use in functions that require it by default. Default value is "default".
string defaultLayout
- Layout to use in cock.setDefault by default. Default value is "default".
table current
- Table that contains all readings for maps at current frame.
table previous
- Table that contains all readings for maps at previous frame.
table joysticks
- Table that contains all used joysticks.
string name
- Joystick name.
number number
- Joystick number.
table etc
- Table that contains miscellaneous data.
string id
- Object ID.
table mouse
- Table that contains mouse-related settings.
number x
- X-coordinate of mouse offset. Default is 0.
number y
- Y-coordinate of mouse offset. Default is 0.
number fx
- Horizontal scaling factor. Default is 1.
number fy
- Vertical scaling factor. Default is 1.
Accessing object.current.* is a suggested way of getting current state of the input.
You can access real joystick names and number by accessing object.joysticks[ # ].name and object.joysticks[ # ].number respectively.
An ID can be read from object.etc.id field.
All mouse settings can be done vla functions (cock.setMouseOffset and cock.setMouseFactor) or directly throguh object.etc.mouse.* fields.