KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches

Types associated with key states More...

Topics

 Flags
 Keyboard key state bit flags
 

Data Structures

union  key_state_t
 Keyboard Key State. More...
 

Macros

#define KEY_STATE_PACK(is_down, was_down)
 Creates a packed key_state_t.
 

Typedefs

typedef enum __packed key_state_value key_state_value_t
 Valid values for key_state_t::value.
 

Functions

static const uint8_t KEY_STATE_NONE ("Please use KEY_STATE_HELD_UP.")
 
static const uint8_t KEY_STATE_WAS_PRESSED ("Please use KEY_STATE_CHANGED_UP.")
 
static const uint8_t KEY_STATE_PRESSED ("Please see key_state_value_t.")
 

Variables

enum __packed key_state_value
 Valid values for key_state_t::value.
 

Detailed Description

Types associated with key states

Key states are represented by the kbd_state_t union type. The state may be accessed by:

  1. Directly comparing key_state_t::value to a key_state_value_t.
  2. Directly using a convenience bit field.
  3. Bitwise AND of key_state_t::raw with one of the Flags.

Macro Definition Documentation

◆ KEY_STATE_PACK

#define KEY_STATE_PACK ( is_down,
was_down )
Value:
(((!!(is_down))? KEY_STATE_IS_DOWN : 0) | \
((!!(was_down))? KEY_STATE_WAS_DOWN : 0))
#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.

Typedef Documentation

◆ 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

Function Documentation

◆ 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

Variable Documentation

◆ key_state_value

enum __packed 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