new Keyboard(options)
This manager handles all keyboard events. It is a substitute for the keyboard component of EventManager.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Members
(readonly) KeyStatus :Symbol
Keyboard KeyStatus.
Type:
- Symbol
- Source:
Methods
(private) _addKeyListeners()
Add key listeners to the document.
- Source:
clearEvents()
Clear all events and resets the circular buffers.
- Source:
getEvents() → {Array.<Keyboard.KeyEvent>}
Get the list of those keyboard events still in the buffer, i.e. those that have not been
previously cleared by calls to getKeys with clear = true.
- Source:
Returns:
the list of events still in the buffer
- Type
- Array.<Keyboard.KeyEvent>
getKeys(options) → {Array.<KeyPress>}
Get the list of keys pressed or pushed by the participant.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
Returns:
the list of keys that were pressed (keydown followed by keyup) or pushed
(keydown with no subsequent keyup at the time getKeys is called).
- Type
- Array.<KeyPress>
includes(keypressList, keyName) → {boolean}
Test whether a list of KeyPress's contains one with a particular name.
Parameters:
Name | Type | Description |
---|---|---|
keypressList |
Array.<module:core.KeyPress> | list of KeyPress's |
keyName |
string | pyglet key name, e.g. 'escape', 'left' |
- Source:
Returns:
whether or not a KeyPress with the given pyglet key name is present in the list
- Type
- boolean
start()
Start recording keyboard events.
- Source:
stop()
Stop recording keyboard events.
- Source: