keyboard
keyboard
¶
Keyboard polling and text input.
keydown and keyup callbacks (see events) tell you about edges. For things
that should keep happening while a key is held, ask isKeyDown each frame.
toKey ¶
proc toKey(sc: SDL_Scancode): Key
The nim2d Key for an SDL scancode, or Key.unknown if it has no name here.
Parameters
-
sc(SDL_Scancode)
Returns
Key
Source:
src/nim2d/keyboard.nim:9
keyScancode ¶
proc keyScancode(key: Key): SDL_Scancode
The SDL scancode for a Key, the inverse of toKey.
Parameters
-
key(Key)
Returns
SDL_Scancode
Source:
src/nim2d/keyboard.nim:53
isKeyDown ¶
proc isKeyDown(scancode: SDL_Scancode): bool
Whether a physical key is currently held down, by SDL scancode.
Parameters
-
scancode(SDL_Scancode)
Returns
bool
Source:
src/nim2d/keyboard.nim:101
isDown ¶
proc isDown(key: Key): bool
Whether key is currently held down. The friendly form of isKeyDown.
Parameters
-
key(Key)
Returns
bool
Source:
src/nim2d/keyboard.nim:108
startTextInput ¶
proc startTextInput(nim2d: Nim2d)
Begin receiving textinput events for typed characters.
Parameters
-
nim2d(Nim2d)
Source:
src/nim2d/keyboard.nim:112
stopTextInput ¶
proc stopTextInput(nim2d: Nim2d)
Generated with mkdocstrings-nim