Difference between revisions of "cock.remapJoystickHat"

m
m
 
Line 1: Line 1:
 
Maps exactly 4 joystick button to work as a joystick hat. It results in virtual hat that would act exactly like regular hat.
 
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 ==
=== Function ===
+
=== Synopsis ===
 
<source lang="Lua">cock.remapJoystickHat ( self, joystick, hat, up, down, left, right )</source>
 
<source lang="Lua">cock.remapJoystickHat ( self, joystick, hat, up, down, left, right )</source>
 
=== Arguments ===
 
=== Arguments ===

Latest revision as of 15:09, 2 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.

Function

Synopsis

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