# Common Organization of Controls Kit Hat modes

Default mode for joystick hat is "8-way" diagonal input, just like default LÖVE's joystick hats, the other general mode is "4-way".

## Basics

Following hat modes are defined:

- "8-way" (1)
- "4-way vertical" (2)
- "4-way horizontal" (3)
- "4-way clockwise" (4)
- "4-way counter-clockwise" (5)
- "4-way diagonal" (6)

## Details

Since 4-way mode would discard all diagonal input, the update handler have 5 modes that specifically tell how to resolve diagonal input:

- Prefer vertical input ("4-way vertical")
  - convert diagonal up to up and diagonal down to down
- Prefer horizontal input ("4-way horizontal")
  - convert diagonal left to left and diagonal right to right
- Prefer clockwise input ("4-way clockwise")
  - "turn" diagonal input 45 degrees clockwise, e.g. down-left becomes left, etc.
- Prefer counter-clockwise input ("4-way counter-clockwise")
  - "turn" diagonal input 45 degrees counter-clockwise, e.g. down-left becomes down, etc.
- Convert diagonal to adjacent lateral ("4-way diagonal")
  - convert diagonal up and left to both lateral up and lateral left

As the name suggests, first two modes are axially biased and will more likely result in getting corresponding direction when actively working on D-pad, and this is more of a gameplay-related setting than actual adjustment, e.g. if you use left and right to move the block in a tetris game, having it accidntally dropped because player would hit the D-pad diagonally down is not desired, and this is when you enable horizontal bias.

The other two are radially biased (in some way they are unbiased) and although they don't make any direction pressed any more likely, they make changing D-pad direction more fluent in one way and more stiff in the other way. This modes give better feel of purely 4-directional D-pad on immediate hat presses, while maintaining only allowing one direction at a time. You may, in fact, just randomly use either of them, but you may also provide choosing between them as an option, since not all joysticks' hats are made so great, and specific mode enabled may actually improve players' accuracy.

The last mode doesn't actually adjusts anything and just passes by the input, "splitting" it in two.

## See also

- cock.setJoystickHatMode
- cock.convertJoystickHatMode
- cock.remapJoystickHat
- Common Organization of Controls Kit Manual
- Common Organization of Controls Kit

Category:

- Libraries