1
# $Id: GameKeys.py 16294 2008-08-29 03:15:17Z campbellbarton $
3
Documentation for the GameKeys module.
4
======================================
6
This module holds key constants for the SCA_KeyboardSensor.
130
# Set a connected keyboard sensor to accept F1
134
co = GameLogic.getCurrentController()
135
# 'Keyboard' is a keyboard sensor
136
sensor = co.getSensor('Keyboard')
137
sensor.setKey(GameKeys.F1KEY)
140
# Do the all keys thing
144
# status: these should be added to a module somewhere
145
KX_NO_INPUTSTATUS = 0
150
co = GameLogic.getCurrentController()
151
# 'Keyboard' is a keyboard sensor
152
sensor = co.getSensor('Keyboard')
153
keylist = sensor.getPressedKeys()
155
# key[0] == GameKeys.keycode, key[1] = status
156
if key[1] == KX_JUSTACTIVATED:
157
if key[0] == GameKeys.WKEY:
159
if key[0] == GameKeys.SKEY:
161
if key[0] == GameKeys.AKEY:
163
if key[0] == GameKeys.DKEY:
168
def EventToString(event):
170
Return the string name of a key event. Will raise a ValueError error if its invalid.
173
@param event: key event from GameKeys or the keyboard sensor.