2004-05-30 11:09:46 +00:00
|
|
|
# $Id$
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|
|
|
|
Documentation for the GameKeys module.
|
2004-05-31 13:06:04 +00:00
|
|
|
======================================
|
2004-05-24 07:49:50 +00:00
|
|
|
|
|
|
|
This module holds key constants for the SCA_KeyboardSensor.
|
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
Alphabet keys
|
|
|
|
-------------
|
|
|
|
- AKEY
|
|
|
|
- BKEY
|
|
|
|
- CKEY
|
|
|
|
- DKEY
|
|
|
|
- EKEY
|
|
|
|
- FKEY
|
|
|
|
- GKEY
|
|
|
|
- HKEY
|
|
|
|
- IKEY
|
|
|
|
- JKEY
|
|
|
|
- KKEY
|
|
|
|
- LKEY
|
|
|
|
- MKEY
|
|
|
|
- NKEY
|
|
|
|
- OKEY
|
|
|
|
- PKEY
|
|
|
|
- QKEY
|
|
|
|
- RKEY
|
|
|
|
- SKEY
|
|
|
|
- TKEY
|
|
|
|
- UKEY
|
|
|
|
- VKEY
|
|
|
|
- WKEY
|
|
|
|
- XKEY
|
|
|
|
- YKEY
|
|
|
|
- ZKEY
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
Number keys
|
|
|
|
-----------
|
|
|
|
- ZEROKEY
|
|
|
|
- ONEKEY
|
|
|
|
- TWOKEY
|
|
|
|
- THREEKEY
|
|
|
|
- FOURKEY
|
|
|
|
- FIVEKEY
|
|
|
|
- SIXKEY
|
|
|
|
- SEVENKEY
|
|
|
|
- EIGHTKEY
|
|
|
|
- NINEKEY
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
Shift Modifiers
|
|
|
|
---------------
|
|
|
|
- CAPSLOCKKEY
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
- LEFTCTRLKEY
|
|
|
|
- LEFTALTKEY
|
|
|
|
- RIGHTALTKEY
|
|
|
|
- RIGHTCTRLKEY
|
|
|
|
- RIGHTSHIFTKEY
|
|
|
|
- LEFTSHIFTKEY
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
Arrow Keys
|
|
|
|
----------
|
|
|
|
- LEFTARROWKEY
|
|
|
|
- DOWNARROWKEY
|
|
|
|
- RIGHTARROWKEY
|
|
|
|
- UPARROWKEY
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
Numberpad Keys
|
|
|
|
--------------
|
|
|
|
- PAD0
|
|
|
|
- PAD1
|
|
|
|
- PAD2
|
|
|
|
- PAD3
|
|
|
|
- PAD4
|
|
|
|
- PAD5
|
|
|
|
- PAD6
|
|
|
|
- PAD7
|
|
|
|
- PAD8
|
|
|
|
- PAD9
|
|
|
|
- PADPERIOD
|
|
|
|
- PADSLASHKEY
|
|
|
|
- PADASTERKEY
|
|
|
|
- PADMINUS
|
|
|
|
- PADENTER
|
|
|
|
- PADPLUSKEY
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
Function Keys
|
|
|
|
-------------
|
|
|
|
- F1KEY
|
|
|
|
- F2KEY
|
|
|
|
- F3KEY
|
|
|
|
- F4KEY
|
|
|
|
- F5KEY
|
|
|
|
- F6KEY
|
|
|
|
- F7KEY
|
|
|
|
- F8KEY
|
|
|
|
- F9KEY
|
|
|
|
- F10KEY
|
|
|
|
- F11KEY
|
|
|
|
- F12KEY
|
2004-05-24 07:49:50 +00:00
|
|
|
|
2004-05-31 13:06:04 +00:00
|
|
|
Other Keys
|
|
|
|
----------
|
|
|
|
- ACCENTGRAVEKEY
|
|
|
|
- BACKSLASHKEY
|
2004-06-26 09:15:41 +00:00
|
|
|
- BACKSPACEKEY
|
|
|
|
- COMMAKEY
|
|
|
|
- DELKEY
|
|
|
|
- ENDKEY
|
2004-05-31 13:06:04 +00:00
|
|
|
- EQUALKEY
|
2004-06-26 09:15:41 +00:00
|
|
|
- ESCKEY
|
2004-05-31 13:06:04 +00:00
|
|
|
- HOMEKEY
|
2004-06-26 09:15:41 +00:00
|
|
|
- INSERTKEY
|
|
|
|
- LEFTBRACKETKEY
|
|
|
|
- LINEFEEDKEY
|
|
|
|
- MINUSKEY
|
2004-05-31 13:06:04 +00:00
|
|
|
- PAGEDOWNKEY
|
2004-06-26 09:15:41 +00:00
|
|
|
- PAGEUPKEY
|
|
|
|
- PAUSEKEY
|
|
|
|
- PERIODKEY
|
|
|
|
- QUOTEKEY
|
|
|
|
- RIGHTBRACKETKEY
|
|
|
|
- RETKEY
|
|
|
|
- SEMICOLONKEY
|
|
|
|
- SLASHKEY
|
|
|
|
- SPACEKEY
|
|
|
|
- TABKEY
|
|
|
|
|
|
|
|
Example::
|
|
|
|
# Set a connected keyboard sensor to accept F1
|
|
|
|
import GameLogic
|
|
|
|
import GameKeys
|
|
|
|
|
|
|
|
co = GameLogic.getCurrentController()
|
|
|
|
# 'Keyboard' is a keyboard sensor
|
|
|
|
sensor = co.getSensor('Keyboard')
|
|
|
|
sensor.setKey(GameKeys.F1KEY)
|
|
|
|
|
|
|
|
Example::
|
|
|
|
# Do the all keys thing
|
|
|
|
import GameLogic
|
|
|
|
import GameKeys
|
|
|
|
|
|
|
|
# status: these should be added to a module somewhere
|
|
|
|
KX_NO_INPUTSTATUS = 0
|
|
|
|
KX_JUSTACTIVATED = 1
|
|
|
|
KX_ACTIVE = 2
|
|
|
|
KX_JUSTRELEASED = 3
|
|
|
|
|
|
|
|
co = GameLogic.getCurrentController()
|
|
|
|
# 'Keyboard' is a keyboard sensor
|
|
|
|
sensor = co.getSensor('Keyboard')
|
|
|
|
keylist = sensor.getPressedKeys()
|
|
|
|
for key in keylist:
|
|
|
|
# key[0] == GameKeys.keycode, key[1] = status
|
|
|
|
if key[1] == KX_JUSTACTIVATED:
|
|
|
|
if key[0] == GameKeys.WKEY:
|
|
|
|
# Activate Forward!
|
|
|
|
if key[0] == GameKeys.SKEY:
|
|
|
|
# Activate Backward!
|
|
|
|
if key[0] == GameKeys.AKEY:
|
|
|
|
# Activate Left!
|
|
|
|
if key[0] == GameKeys.DKEY:
|
|
|
|
# Activate Right!
|
|
|
|
|
2004-05-24 07:49:50 +00:00
|
|
|
"""
|