Event Types
/** Input event types */
typedef enum {
D3TUI_EVENT_NONE,
D3TUI_EVENT_KEY_DOWN,
D3TUI_EVENT_KEY_UP,
D3TUI_EVENT_KEY_REPEAT,
D3TUI_EVENT_CHARACTER,
D3TUI_EVENT_MOUSE_MOVE,
D3TUI_EVENT_MOUSE_DOWN,
D3TUI_EVENT_MOUSE_UP,
D3TUI_EVENT_CONTROLLER_BUTTON_DOWN,
D3TUI_EVENT_CONTROLLER_BUTTON_UP,
D3TUI_EVENT_CONTROLLER_AXIS
} d3tui_event_type_t;
/** Key modifiers */
typedef enum {
D3TUI_MOD_NONE = 0,
D3TUI_MOD_SHIFT = 1 << 0,
D3TUI_MOD_CTRL = 1 << 1,
D3TUI_MOD_ALT = 1 << 2,
D3TUI_MOD_SUPER = 1 << 3,
D3TUI_MOD_CAPS = 1 << 4,
D3TUI_MOD_NUM = 1 << 5,
D3TUI_MOD_META = 1 << 6
} d3tui_mod_t;
/** Key codes (Dreamcast controller and keyboard) */
typedef enum {
D3TUI_KEY_UNKNOWN = 0,
D3TUI_KEY_NONE,
D3TUI_KEY_A,
D3TUI_KEY_B,
D3TUI_KEY_X,
D3TUI_KEY_Y,
D3TUI_KEY_START,
D3TUI_KEY_DPAD_UP,
D3TUI_KEY_DPAD_DOWN,
D3TUI_KEY_DPAD_LEFT,
D3TUI_KEY_DPAD_RIGHT,
D3TUI_KEY_TRIGGER_LEFT,
D3TUI_KEY_TRIGGER_RIGHT,
D3TUI_KEY_SPACE = 32,
// ... ASCII keys 32-126 ...
D3TUI_KEY_KP_0 = 256,
// ... Keypad and special keys ...
D3TUI_KEY_MAX
} d3tui_key_t;
/** Input event structure */
typedef struct {
d3tui_event_type_t type;
d3tui_key_t key; // Key or button code
uint32_t character; // Unicode character (for CHARACTER events)
d3tui_mod_t mods; // Modifier flags
int mouse_x; // For mouse events
int mouse_y; // For mouse events
uint32_t mouse_button; // For mouse button events
int controller_port; // Controller port (0-3)
int axis; // Axis index (for axis events)
float value; // Axis value (-1.0 to 1.0)
bool repeated; // Whether this is a repeated event
} d3tui_event_t;