~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/gameengine/PyDoc/bge.events.rst

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
Game Engine bge.events module
3
 
=============================
4
 
 
5
 
*****
6
 
Intro
7
 
*****
8
 
 
9
 
This module holds key constants for the SCA_KeyboardSensor.
10
 
 
11
 
.. module:: bge.events
12
 
 
13
 
.. code-block:: python
14
 
 
15
 
        # Set a connected keyboard sensor to accept F1
16
 
        import bge
17
 
        
18
 
        co = bge.logic.getCurrentController()
19
 
        # 'Keyboard' is a keyboard sensor
20
 
        sensor = co.sensors["Keyboard"]
21
 
        sensor.key = bge.keys.F1KEY
22
 
 
23
 
.. code-block:: python
24
 
 
25
 
        # Do the all keys thing
26
 
        import bge
27
 
        
28
 
        co = bge.logic.getCurrentController()
29
 
        # 'Keyboard' is a keyboard sensor
30
 
        sensor = co.sensors["Keyboard"]
31
 
 
32
 
        for key,status in sensor.events:
33
 
                # key[0] == bge.keys.keycode, key[1] = status
34
 
                if status == bge.logic.KX_INPUT_JUST_ACTIVATED:
35
 
                        if key == bge.keys.WKEY:
36
 
                                # Activate Forward!
37
 
                        if key == bge.keys.SKEY:
38
 
                                # Activate Backward!
39
 
                        if key == bge.keys.AKEY:
40
 
                                # Activate Left!
41
 
                        if key == bge.keys.DKEY:
42
 
                                # Activate Right!
43
 
 
44
 
*********
45
 
Functions
46
 
*********
47
 
 
48
 
.. function:: EventToString(event)
49
 
 
50
 
   Return the string name of a key event. Will raise a ValueError error if its invalid.
51
 
 
52
 
   :arg event: key event from bge.keys or the keyboard sensor.
53
 
   :type event: int
54
 
   :rtype: string
55
 
   
56
 
.. function:: EventToCharacter(event, shift)
57
 
 
58
 
   Return the string name of a key event. Returns an empty string if the event cant be represented as a character.
59
 
   
60
 
   :type event: int
61
 
   :arg event: key event from :mod:`bge.keys` or the keyboard sensor.
62
 
   :type shift: bool
63
 
   :arg shift: set to true if shift is held.
64
 
   :rtype: string
65
 
 
66
 
****************
67
 
Keys (Constants)
68
 
****************
69
 
 
70
 
.. _mouse-keys:
71
 
 
72
 
==========
73
 
Mouse Keys
74
 
==========
75
 
 
76
 
.. data:: LEFTMOUSE
77
 
.. data:: MIDDLEMOUSE
78
 
.. data:: RIGHTMOUSE
79
 
.. data:: WHEELUPMOUSE
80
 
.. data:: WHEELDOWNMOUSE
81
 
.. data:: MOUSEX
82
 
.. data:: MOUSEY
83
 
 
84
 
.. _keyboard-keys:
85
 
 
86
 
=============
87
 
Keyboard Keys
88
 
=============
89
 
 
90
 
-------------
91
 
Alphabet keys
92
 
-------------
93
 
 
94
 
.. data:: AKEY
95
 
.. data:: BKEY
96
 
.. data:: CKEY
97
 
.. data:: DKEY
98
 
.. data:: EKEY
99
 
.. data:: FKEY
100
 
.. data:: GKEY
101
 
.. data:: HKEY
102
 
.. data:: IKEY
103
 
.. data:: JKEY
104
 
.. data:: KKEY
105
 
.. data:: LKEY
106
 
.. data:: MKEY
107
 
.. data:: NKEY
108
 
.. data:: OKEY
109
 
.. data:: PKEY
110
 
.. data:: QKEY
111
 
.. data:: RKEY
112
 
.. data:: SKEY
113
 
.. data:: TKEY
114
 
.. data:: UKEY
115
 
.. data:: VKEY
116
 
.. data:: WKEY
117
 
.. data:: XKEY
118
 
.. data:: YKEY
119
 
.. data:: ZKEY
120
 
 
121
 
-----------
122
 
Number keys
123
 
-----------
124
 
 
125
 
.. data:: ZEROKEY
126
 
.. data:: ONEKEY
127
 
.. data:: TWOKEY
128
 
.. data:: THREEKEY
129
 
.. data:: FOURKEY
130
 
.. data:: FIVEKEY
131
 
.. data:: SIXKEY
132
 
.. data:: SEVENKEY
133
 
.. data:: EIGHTKEY
134
 
.. data:: NINEKEY
135
 
 
136
 
--------------
137
 
Modifiers Keys
138
 
--------------
139
 
 
140
 
.. data:: CAPSLOCKKEY
141
 
.. data:: LEFTCTRLKEY
142
 
.. data:: LEFTALTKEY
143
 
.. data:: RIGHTALTKEY
144
 
.. data:: RIGHTCTRLKEY
145
 
.. data:: RIGHTSHIFTKEY
146
 
.. data:: LEFTSHIFTKEY
147
 
 
148
 
----------
149
 
Arrow Keys
150
 
----------
151
 
 
152
 
.. data:: LEFTARROWKEY
153
 
.. data:: DOWNARROWKEY
154
 
.. data:: RIGHTARROWKEY
155
 
.. data:: UPARROWKEY
156
 
 
157
 
--------------
158
 
Numberpad Keys
159
 
--------------
160
 
 
161
 
.. data:: PAD0
162
 
.. data:: PAD1
163
 
.. data:: PAD2
164
 
.. data:: PAD3
165
 
.. data:: PAD4
166
 
.. data:: PAD5
167
 
.. data:: PAD6
168
 
.. data:: PAD7
169
 
.. data:: PAD8
170
 
.. data:: PAD9
171
 
.. data:: PADPERIOD
172
 
.. data:: PADSLASHKEY
173
 
.. data:: PADASTERKEY
174
 
.. data:: PADMINUS
175
 
.. data:: PADENTER
176
 
.. data:: PADPLUSKEY
177
 
 
178
 
-------------
179
 
Function Keys
180
 
-------------
181
 
 
182
 
.. data:: F1KEY
183
 
.. data:: F2KEY
184
 
.. data:: F3KEY
185
 
.. data:: F4KEY
186
 
.. data:: F5KEY
187
 
.. data:: F6KEY
188
 
.. data:: F7KEY
189
 
.. data:: F8KEY
190
 
.. data:: F9KEY
191
 
.. data:: F10KEY
192
 
.. data:: F11KEY
193
 
.. data:: F12KEY
194
 
.. data:: F13KEY
195
 
.. data:: F14KEY
196
 
.. data:: F15KEY
197
 
.. data:: F16KEY
198
 
.. data:: F17KEY
199
 
.. data:: F18KEY
200
 
.. data:: F19KEY
201
 
 
202
 
----------
203
 
Other Keys
204
 
----------
205
 
 
206
 
.. data:: ACCENTGRAVEKEY
207
 
.. data:: BACKSLASHKEY
208
 
.. data:: BACKSPACEKEY
209
 
.. data:: COMMAKEY
210
 
.. data:: DELKEY
211
 
.. data:: ENDKEY
212
 
.. data:: EQUALKEY
213
 
.. data:: ESCKEY
214
 
.. data:: HOMEKEY
215
 
.. data:: INSERTKEY
216
 
.. data:: LEFTBRACKETKEY
217
 
.. data:: LINEFEEDKEY
218
 
.. data:: MINUSKEY
219
 
.. data:: PAGEDOWNKEY
220
 
.. data:: PAGEUPKEY
221
 
.. data:: PAUSEKEY
222
 
.. data:: PERIODKEY
223
 
.. data:: QUOTEKEY
224
 
.. data:: RIGHTBRACKETKEY
225
 
.. data:: RETKEY
226
 
.. data:: SEMICOLONKEY
227
 
.. data:: SLASHKEY
228
 
.. data:: SPACEKEY
229
 
.. data:: TABKEY