Difference between revisions of "cock.bind"

m (Arguments)
m (Arguments)
Line 8: Line 8:
 
{{param|string|map|A controls input map to bind controls.}}
 
{{param|string|map|A controls input map to bind controls.}}
 
{{param|string|option|Optional. An option to which bind the controls. Will revert to [[cock.fields|cock.defaultOption]] if not provided.}}
 
{{param|string|option|Optional. An option to which bind the controls. Will revert to [[cock.fields|cock.defaultOption]] if not provided.}}
{{param|string|device|[[cock.inputdevices|Input device]] to use.}}
+
{{param|string|device|[[Common Organization of Controls Kit Input devices|Input device]] to use.}}
{{param|string|key|[[cock.keys|Reading]] of an input device to bind.}}
+
{{param|string|key|[[Common Organization of Controls Kit Input keys|Reading]] of an input device to bind.}}
{{param|string|inverse|Optional. [[cock.modes|Inversion]] mode. Will use "positive cutoff" if not provided.}}
+
{{param|string|inverse|Optional. [[Common Organization of Controls Kit Input modes|Inversion]] mode. Will use "positive cutoff" if not provided.}}
{{param|string|delta|Optional. [[cock.modes|Delta]] mode. Will use "bypass" if nor provided.}}
+
{{param|string|delta|Optional. [[Common Organization of Controls Kit Input modes|Delta]] mode. Will use "bypass" if nor provided.}}
 
{{param|number|value|Optional. Raw value of the input reading during capture. Will use 0 if not provided.}}
 
{{param|number|value|Optional. Raw value of the input reading during capture. Will use 0 if not provided.}}
{{param|string|joystick|Optional. [[cock.inputdevices|Internal alias]] of joystick to use. Will use 1 if not provided.}}
+
{{param|string|joystick|Optional. [[Common Organization of Controls Kit Input devices|Internal alias]] of joystick to use. Will use 1 if not provided.}}
{{param|string|longdata|A string coming from [[cock.events|cock.controlcaptured]] event.}}
+
{{param|string|longdata|A string coming from [[Common Organization of Controls Kit Events|cock.controlcaptured]] event.}}
  
 
Alternatively, instead of using literal values for device, key, inverse, delta and joystick arguments, you can pass numerical values. Although, just using magic numbers to set values by hand in your code will only make it messier, and given that internal conversion is an optimized operation and you wouldn't call this function hundreds of times every frame, that would make no performance difference.
 
Alternatively, instead of using literal values for device, key, inverse, delta and joystick arguments, you can pass numerical values. Although, just using magic numbers to set values by hand in your code will only make it messier, and given that internal conversion is an optimized operation and you wouldn't call this function hundreds of times every frame, that would make no performance difference.

Revision as of 11:09, 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
Optional. Inversion mode. Will use "positive cutoff" if not provided.
string delta
Optional. Delta mode. Will use "bypass" if nor provided.
number value
Optional. Raw value of the input reading during capture. Will use 0 if not provided.
string joystick
Optional. Internal alias of joystick to use. Will use 1 if not provided.
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. Although, just using magic numbers to set values by hand in your code will only make it messier, and given that internal conversion is an optimized operation and you wouldn't call this function hundreds of times every frame, that would make no performance difference.

See also