Difference between revisions of "cock.bind"
m (→Arguments) |
|||
Line 1: | Line 1: | ||
Binds controls to the current layout. | Binds controls to the current layout. | ||
− | == | + | == Function == |
− | === | + | === Synopsis === |
− | <source lang="Lua">cock.bind ( self, map, option, device, key, inverse, delta, value, joystick | + | <source lang="Lua">cock.bind ( self, map, option, device, key, inverse, delta, value, joystick )</source> |
− | |||
=== Arguments === | === Arguments === | ||
{{param|table|self|An object to use.}} | {{param|table|self|An object to use.}} | ||
Line 14: | Line 13: | ||
{{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. [[Common Organization of Controls Kit Input devices|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.}} | ||
+ | === Synopsis === | ||
+ | <source lang="Lua">cock.bind ( self, longdata )</source> | ||
+ | === Arguments === | ||
+ | {{param|table|self|An object to use.}} | ||
{{param|string|longdata|A string coming from [[Common Organization of Controls Kit Callbacks|cock.controlcaptured]] event.}} | {{param|string|longdata|A string coming from [[Common Organization of Controls Kit Callbacks|cock.controlcaptured]] event.}} | ||
− | + | == Remarks == | |
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. | ||
− | |||
==See also== | ==See also== | ||
*[[cock.addOption]] | *[[cock.addOption]] |
Revision as of 14:54, 2 September 2013
Binds controls to the current layout.
Function
Synopsis
cock.bind ( self, map, option, device, key, inverse, delta, value, joystick )
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 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.
Synopsis
cock.bind ( self, longdata )
Arguments
table self
- An object to use.
string longdata
- A string coming from cock.controlcaptured event.
Remarks
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
- cock.addOption
- cock.unbind
- cock.getBinded
- Common Organization of Controls Kit Callbacks
- Common Organization of Controls Kit Input devices
- Common Organization of Controls Kit Input keys
- Common Organization of Controls Kit Modes
- Common Organization of Controls Kit Fields
- Common Organization of Controls Kit Manual
- Common Organization of Controls Kit