# cock.remapJoystickHat

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

- cock.addJoystick
- cock.setJoystickHatMode
- Common Organization of Controls Kit Fields
- Common Organization of Controls Kit Manual
- Common Organization of Controls Kit

Category:

- Functions