CGPdocs

inputs_keyboard_parameters

Keyboard state (inputs.keyboard) with is_pressed(key) and the shift, ctrl and arrow flags.

module 15_input_devicessource: input_devices.hpp

Fields and methods

Members of the struct inputs_keyboard_parameters. Most of what you do with a CGP type goes through the free functions listed below.

Fields

bool shiftTrue while one of the two Shift keys is held down.
bool ctrlTrue while one of the two Control keys is held down.
bool upTrue while the Up arrow key is held down.
bool downTrue while the Down arrow key is held down.
bool rightTrue while the Right arrow key is held down.
bool leftTrue while the Left arrow key is held down.
inputs_keyboard_last_action_parameter last_actionKey and action (press, release, repeat) of the last keyboard event, to react once to a key press in keyboard_event().
std::set<int> pressed_keys_storageSet of the GLFW key codes currently held down, read by is_pressed (internal storage, not meant to be modified).

Methods

bool is_pressed(int glfw_key) constReturns true while the key with this GLFW code (GLFW_KEY_A, GLFW_KEY_SPACE...) is held down; the code is a key position, the QWERTY name of the key.3 overloads src
bool is_pressed(char keyname) constReturns true while the key whose character is keyname on the keyboard in use (layout-aware, e.g. 'z' on AZERTY) is held down; printable keys only. src
bool is_pressed(std::string const& keyname) constReturns true while a held key has this name for the keyboard layout in use (glfwGetKeyName, e.g. "k"); printable keys only, use the GLFW code for Space or the arrows. src
Builds a keyboard state with no key held (shift, ctrl and the arrow flags false). src
Updates the held keys, the shift, ctrl and arrow flags and last_action from a GLFW key event (called by the application, not by the scene). src

Functions taking a inputs_keyboard_parameters

None.

Functions returning a inputs_keyboard_parameters

None.

Operators

None.

CGP - Computer Graphics Programming.