PMC simplifies the keyboard in order to aid rapid development. There are few rules that this includes:
- All keys are in the same case, so pressing 'a' and 'A' will both map to the same key.
- Duplicate keys map to the same key, so pressing '8' on the numberpad is the same as pressing '8' on the keyboard top row.
- Key names are case insensetive, to 'space', 'Space', 'SPACE' and 'sPaCe' all map the same space key.
Named Keys
Keys of a single character, for example 'w', 'a', 's', 'd, 'e', '0', '1', '2', etc, can all be queried using those characters.
if getControls().isKeyDown( :w )
player.moveForward()
endHowever some keys have a full name, and these are:
- f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12
- backspace
- tab
- enter
- shift
- control
- alt
- pause
- caps lock
- space
- page up
- page down
- end
- home
- left
- up
- right
- down
- insert
- delete
c = getControls()
if c.isKeyDown( 'left' )
player.moveLeft()
else if c.isKeyDown( 'right' )
player.moveRight()
end