Difference between revisions of "cock.bind"

m (Arguments)
m (Arguments)
Line 14: Line 14:
 
{{param|number|value|Raw value of the input reading during capture.}}
 
{{param|number|value|Raw value of the input reading during capture.}}
 
{{param|string|joystick|[[cock.inputdevices|Internal alias]] of joystick to use.}}
 
{{param|string|joystick|[[cock.inputdevices|Internal alias]] of joystick to use.}}
{{param|string|longdata|A string coming from [[cock.events|cock.controlcaptured]] event.
+
{{param|string|longdata|A string coming from [[cock.events|cock.controlcaptured]] event.}}
  
 
Alternatively, instead of using literal values for device, key, inverse, delta and joystick arguments, you can pass numerical values. This will make the code look messier though, and, given that you wouldn't call it hundreds of times every frame, it makes no performance difference.
 
Alternatively, instead of using literal values for device, key, inverse, delta and joystick arguments, you can pass numerical values. This will make the code look messier though, and, given that you wouldn't call it hundreds of times every frame, it makes no performance difference.

Revision as of 10:59, 1 September 2013

Binds controls to the current layout.

Synopsis

Function

cock.bind ( self, map, option, device, key, inverse, delta, value, joystick )
cock.bind ( self, longdata )

Arguments

table self
An object to use.
string map
A controls input map to bind controls.
string option
Optional. An option to which bind the controls. Will revert to cock.defaultOption if not provided.
string device
Input device to use.
string key
Reading of an input device to bind.
string inverse
Inversion mode.
string delta
Delta mode.
number value
Raw value of the input reading during capture.
string joystick
Internal alias of joystick to use.
string longdata
A string coming from cock.controlcaptured event.

Alternatively, instead of using literal values for device, key, inverse, delta and joystick arguments, you can pass numerical values. This will make the code look messier though, and, given that you wouldn't call it hundreds of times every frame, it makes no performance difference.

See also