Common Organization of Controls Kit Input keys

Input keys are essentially what LÖVE's .isDown and such report when called.

Basics

Input keys for keyboard is strings reported by love.keyboard.isDown, same for mouse and joystick buttons and hats. Joystick axis are represented as themselves. Mouse axis are mapped to numbers: X axis is 1, and Y axis is 2. Additionally, following axis names are defined:

  • "x" (1)
  • "y" (2)
  • "z" (3)
  • "r" (4)
  • "u" (5)
  • "v" (6)
  • "7" (7)
  • "8" (8), etc.

Details

Input keys are what they are, except for mouse axis, which are mapped to numbers. When using any function that accepts an input key, you can either provide a regular value, which is useful for programmatical input, or for axis-like devices you can provide literal value, which is useful for user interaction. You shouldn't use numerical values for hard-coding data, because 1) that will make your code messier with all of these magic numbers and 2) internal conversion is an effecient and optimized operation, and it won't save execution time.

See also

Personal tools