Difference between revisions of "cock.remapJoystickHat"

m
m
Line 5: Line 5:
 
=== Arguments ===
 
=== Arguments ===
 
{{param|table|self|An object to use.}}
 
{{param|table|self|An object to use.}}
{{param|number|joystick|Optional. Internal joystick number. Will use 1 if not provided.
+
{{param|number|joystick|Optional. Internal joystick number. Will use 1 if not provided.}}
{{param|string|joystick|Optional. Internal joystick name.
+
{{param|string|joystick|Optional. Internal joystick name.}}
{{param|number|hat|Optional. LÖVE hat number. Will use 1 if not provided.
+
{{param|number|hat|Optional. LÖVE hat number. Will use 1 if not provided.}}
{{param|string|hat|Optional. [[Common Organization of Controls Kit Input devices|Hat name]].
+
{{param|string|hat|Optional. [[Common Organization of Controls Kit Input devices|Hat name]].}}
 
{{param|number|up|Optional. Button to map to dpad Up direction. Will use last value if not provided.}}
 
{{param|number|up|Optional. Button to map to dpad Up direction. Will use last value if not provided.}}
{{param|number|down|Optional. Button to map to dpad Down direction. Will use last value if not provided.
+
{{param|number|down|Optional. Button to map to dpad Down direction. Will use last value if not provided.}}
 
{{param|number|left|Optional. Button to map to dpad Left direction. Will use last value if not provided.}}
 
{{param|number|left|Optional. Button to map to dpad Left direction. Will use last value if not provided.}}
{{param|number|right|Optional. Button to map to dpad Right direction. Will use last value if not provided.
+
{{param|number|right|Optional. Button to map to dpad Right direction. Will use last value if not provided.}}
 
== Remarks ==
 
== Remarks ==
 
Omitting all directions un-remaps the hat. You can map buttons one by one, but incomplete mapping would result in partial functionality (some directions won't work).
 
Omitting all directions un-remaps the hat. You can map buttons one by one, but incomplete mapping would result in partial functionality (some directions won't work).

Revision as of 18:59, 1 September 2013

Maps exactly 4 joystick button to work as a joystick hat. It results in virtual hat that would act exactly like regular hat.

Synopsis

Function

cock.remapJoystickHat ( self, joystick, hat, up, down, left, right )

Arguments

table self
An object to use.
number joystick
Optional. Internal joystick number. Will use 1 if not provided.
string joystick
Optional. Internal joystick name.
number hat
Optional. LÖVE hat number. Will use 1 if not provided.
string hat
Optional. Hat name.
number up
Optional. Button to map to dpad Up direction. Will use last value if not provided.
number down
Optional. Button to map to dpad Down direction. Will use last value if not provided.
number left
Optional. Button to map to dpad Left direction. Will use last value if not provided.
number right
Optional. Button to map to dpad Right direction. Will use last value if not provided.

Remarks

Omitting all directions un-remaps the hat. You can map buttons one by one, but incomplete mapping would result in partial functionality (some directions won't work).

See also