Types associated with key states
More...
|
| Flags |
| Keyboard key state bit flags
|
|
Types associated with key states
Key states are represented by the kbd_state_t union type. The state may be accessed by:
- Directly comparing key_state_t::value to a key_state_value_t.
- Directly using a convenience bit field.
- Bitwise
AND
of key_state_t::raw with one of the Flags.
◆ KEY_STATE_PACK
#define KEY_STATE_PACK |
( |
| is_down, |
|
|
| was_down ) |
Value:
#define KEY_STATE_WAS_DOWN
If key was previously down.
Definition keyboard.h:347
#define KEY_STATE_IS_DOWN
If key is currenty down.
Definition keyboard.h:346
Creates a packed key_state_t.
This macro is used to pack two frames worth of key state information into a key_state_t, one bit per frame.
◆ key_state_value_t
Valid values for key_state_t::value.
Enumerates each of the 4 different states a key can be in, by combining two frames worth of key down information into two bits.
- Note
- Two of the values are for
HELD
states, meaning the same state has been observed for both the current and the previous frame, while the other two values are for CHANGE
states, meaning the current frame has a different state from the previous frame.
- See also
- Flags, key_state_t::value
◆ KEY_STATE_NONE()
static const uint8_t KEY_STATE_NONE |
( |
"Please use KEY_STATE_HELD_UP." | | ) |
|
|
static |
◆ KEY_STATE_PRESSED()
static const uint8_t KEY_STATE_PRESSED |
( |
"Please see key_state_value_t." | | ) |
|
|
static |
◆ KEY_STATE_WAS_PRESSED()
static const uint8_t KEY_STATE_WAS_PRESSED |
( |
"Please use KEY_STATE_CHANGED_UP." | | ) |
|
|
static |
◆ key_state_value
Valid values for key_state_t::value.
Enumerates each of the 4 different states a key can be in, by combining two frames worth of key down information into two bits.
- Note
- Two of the values are for
HELD
states, meaning the same state has been observed for both the current and the previous frame, while the other two values are for CHANGE
states, meaning the current frame has a different state from the previous frame.
- See also
- Flags, key_state_t::value