]>
git.r.bdr.sh - rbdr/sumo/blob - lib/components/control_map.js
4edf31806b27f171a006cf47e105b72f2073c354
1 import { Component
} from '@serpentity/serpentity';
4 * The contorl mapping object, holds a source and target for the action.
9 * @property {tControlSource} source the source input for the action
10 * @property {tControlTarget} target the target property for the action
14 * The definition of an input source
16 * @typedef tControlSource
19 * @property {string} type type of input, can be keyboard or gamepad
20 * @property {number} gamepadNumber the number of gamepad to use
21 * @property {string} gamepadInputSource either axes or buttons
22 * @property {number} index the input index or keycode
26 * The definition of an input target
28 * @typedef tControlTarget
31 * @property {external:Serpentity:Component} component the component affected by this
32 * @property {string} property property to affect. For nested properties use dot.notation
33 * @property {[function]} value a function that takes in the input and outputs a transformed value
37 * Component that stores the state of motion controls to properties
39 * @extends {external:Serpentity.Component}
40 * @class ControlMapComponent
41 * @param {object} config a configuration object to extend.
43 export default class ControlMapComponent
extends Component
{
49 * The map of actions and controls. An array of mappings
51 * @property {Array<tControlMap>} map
53 * @memberof ControlMapComponent
55 this.map
= this.map
|| [];