1 /* NetHack 3.7	mhinput.h	$NHDT-Date: 1596498351 2020/08/03 23:45:51 $  $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.11 $ */
2 /* Copyright (C) 2001 by Alex Kompel 	 */
3 /* NetHack may be freely redistributed.  See license for details. */
4 
5 #ifndef MSWINInput_h
6 #define MSWINInput_h
7 
8 /* nethack input queue - store/extract input events */
9 #include "winMS.h"
10 
11 #define NHEVENT_CHAR 1
12 #define NHEVENT_MOUSE 2
13 
14 union event_innards {
15     struct {
16         int ch;
17     } kbd;
18 
19     struct {
20        int mod;
21        int x, y;
22     } ms;
23 };
24 
25 typedef struct mswin_event {
26     int type;
27     union event_innards ei;
28 } MSNHEvent, *PMSNHEvent;
29 
30 #define NHEVENT_KBD(c)         \
31     {                          \
32         MSNHEvent e;           \
33         e.type = NHEVENT_CHAR; \
34         e.ei.kbd.ch = (c);        \
35         mswin_input_push(&e);  \
36     }
37 #define NHEVENT_MS(_mod, _x, _y) \
38     {                            \
39         MSNHEvent e;             \
40         e.type = NHEVENT_MOUSE;  \
41         e.ei.ms.mod = (_mod);       \
42         e.ei.ms.x = (_x);           \
43         e.ei.ms.y = (_y);           \
44         mswin_input_push(&e);    \
45     }
46 
47 void mswin_nh_input_init(void);
48 int mswin_have_input(void);
49 void mswin_input_push(PMSNHEvent event);
50 PMSNHEvent mswin_input_pop(void);
51 PMSNHEvent mswin_input_peek(void);
52 
53 #endif /* MSWINInput_h */
54