2019-12-08 11:28:51 +00:00
|
|
|
#pragma once
|
2019-11-03 17:19:29 +00:00
|
|
|
#include <functional>
|
|
|
|
|
|
|
|
// Input event types.
|
|
|
|
enum EGenericEvent
|
|
|
|
{
|
|
|
|
EV_None,
|
|
|
|
EV_KeyDown, // data1: scan code, data2: Qwerty ASCII code
|
|
|
|
EV_KeyUp, // same
|
|
|
|
EV_Mouse, // x, y: mouse movement deltas
|
|
|
|
EV_GUI_Event, // subtype specifies actual event
|
|
|
|
EV_DeviceChange,// a device has been connected or removed
|
|
|
|
};
|
|
|
|
|
|
|
|
// Event structure.
|
|
|
|
struct event_t
|
|
|
|
{
|
|
|
|
uint8_t type;
|
|
|
|
uint8_t subtype;
|
2019-12-08 11:28:51 +00:00
|
|
|
int16_t data1; // keys / mouse/joystick buttons
|
2019-11-03 17:19:29 +00:00
|
|
|
int16_t data2;
|
|
|
|
int16_t data3;
|
|
|
|
int x; // mouse/joystick x move
|
|
|
|
int y; // mouse/joystick y move
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Called by IO functions when input is detected.
|
|
|
|
void D_PostEvent (const event_t* ev);
|
|
|
|
void D_RemoveNextCharEvent();
|
2019-11-03 19:24:50 +00:00
|
|
|
void D_ProcessEvents(void);
|
2019-11-03 17:19:29 +00:00
|
|
|
|
2019-11-03 23:53:55 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
NUM_EVENTS = 128
|
|
|
|
};
|
2019-11-03 17:19:29 +00:00
|
|
|
|
2019-11-03 23:53:55 +00:00
|
|
|
extern event_t events[NUM_EVENTS];
|
2019-11-03 17:19:29 +00:00
|
|
|
|