11 char keystates
[MAX_KEYS
];
16 static event_t eventqueue
[MAX_EVENTS
];
17 static int eventhead
, eventpos
;
20 int ev_postevent(event_t
*ev
)
23 nextevent
= (eventhead
+1)%MAX_EVENTS
;
24 if (nextevent
== eventpos
)
26 eventqueue
[eventhead
] = *ev
;
27 eventhead
= nextevent
;
31 int ev_getevent(event_t
*ev
)
33 if (eventpos
== eventhead
)
38 *ev
= eventqueue
[eventpos
];
39 eventpos
= (eventpos
+1)%MAX_EVENTS
;
40 if (ev
->type
== EV_PRESS
)
42 keystates
[ev
->code
] = 1;
45 if (ev
->type
== EV_RELEASE
)
47 keystates
[ev
->code
] = 0;
49 if (nkeysdown
< 0) nkeysdown
= 0;