mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-11 15:51:36 +00:00
a3ed5926b9
id and z seem to always be 0. Ironically, it turns out that the work needed for "int id" and "large" struct nil init wasn't strictly necessary to get to this point, but without having done that work, I wouldn't know :)
38 lines
891 B
R
38 lines
891 B
R
#include "event.h"
|
|
|
|
typedef struct window_s *window_t;
|
|
|
|
void initialize (void) = #0;
|
|
window_t create_window (int xpos, int ypos, int xlen, int ylen) = #0;
|
|
void destroy_window (window_t win) = #0;
|
|
void wprintf (window_t win, string fmt, ...) = #0;
|
|
int wgetch (window_t win) = #0;
|
|
|
|
void process_input (void) = #0;
|
|
int get_event (qwaq_event_t *event) = #0;
|
|
|
|
int main (int argc, string *argv)
|
|
{
|
|
int ch = 0;
|
|
qwaq_event_t event = { };
|
|
|
|
initialize ();
|
|
window_t win = create_window (20, 5, 50, 10);
|
|
wprintf (win, "Hi there!\n");
|
|
do {
|
|
process_input ();
|
|
|
|
if (get_event (&event)) {
|
|
if (event.event_type == qe_key) {
|
|
ch = event.e.key;
|
|
wprintf (win, "key: %d\n", ch);
|
|
} else if (event.event_type == qe_mouse) {
|
|
wprintf (win, "mouse: %d %d %d\n",
|
|
event.e.mouse.x,
|
|
event.e.mouse.y,
|
|
event.e.mouse.buttons);
|
|
}
|
|
}
|
|
} while (ch != 27);
|
|
return 0;
|
|
}
|