File: BzfEvent.h

package info (click to toggle)
bzflag 2.4.30-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 26,488 kB
  • sloc: cpp: 150,376; ansic: 3,463; sh: 2,535; makefile: 2,194; perl: 486; python: 260; objc: 246; php: 206
file content (249 lines) | stat: -rw-r--r-- 4,819 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
/* bzflag
 * Copyright (c) 1993-2025 Tim Riker
 *
 * This package is free software;  you can redistribute it and/or
 * modify it under the terms of the license found in the file
 * named COPYING that should have accompanied this file.
 *
 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

/* BzfEvent:
 *  Abstract, platform independent base for OpenGL windows.
 */

#ifndef BZF_EVENT_H
#define BZF_EVENT_H

#include "common.h"

class BzfWindow;

class BzfQuitEvent
{
public:
};

class BzfMotionEvent
{
public:
    int         x;
    int         y;
};

class BzfResizeEvent
{
public:
    int         width;
    int         height;
};

class BzfMapEvent
{
public:
};

class BzfUnmapEvent
{
public:
};

class BzfKeyEvent
{
public:
    enum Button
    {
        NoButton = 0,
        Pause,

        /* Arrows + Home/End pad */
        Home,
        End,
        Left,
        Right,
        Up,
        Down,
        PageUp,
        PageDown,
        Insert,
        /* Ascii character */
        Backspace,
        Delete,
        /* Numeric keypad */
        Kp0,
        Kp1,
        Kp2,
        Kp3,
        Kp4,
        Kp5,
        Kp6,
        Kp7,
        Kp8,
        Kp9,
        Kp_Period,
        Kp_Divide,
        Kp_Multiply,
        Kp_Minus,
        Kp_Plus,
        Kp_Enter,
        Kp_Equals,
        /* Function keys */
        F1,
        F2,
        F3,
        F4,
        F5,
        F6,
        F7,
        F8,
        F9,
        F10,
        F11,
        F12,
        /* Miscellaneous function keys */
        Help,
        Print,
        Sysreq,
        Break,
        Menu,
        Power,
        Euro,
        Undo,
        /* Mouse buttons */
        LeftMouse,
        MiddleMouse,
        RightMouse,
        WheelUp,
        WheelDown,
        MouseButton6,
        MouseButton7,
        MouseButton8,
        MouseButton9,
        MouseButton10,
        /* Joystick buttons */
        BZ_Button_1,
        BZ_Button_2,
        BZ_Button_3,
        BZ_Button_4,
        BZ_Button_5,
        BZ_Button_6,
        BZ_Button_7,
        BZ_Button_8,
        BZ_Button_9,
        BZ_Button_10,
        BZ_Button_11,
        BZ_Button_12,
        BZ_Button_13,
        BZ_Button_14,
        BZ_Button_15,
        BZ_Button_16,
        BZ_Button_17,
        BZ_Button_18,
        BZ_Button_19,
        BZ_Button_20,
        BZ_Button_21,
        BZ_Button_22,
        BZ_Button_23,
        BZ_Button_24,
        BZ_Button_25,
        BZ_Button_26,
        BZ_Button_27,
        BZ_Button_28,
        BZ_Button_29,
        BZ_Button_30,
        BZ_Button_31,
        BZ_Button_32,
        BZ_Hatswitch_1_upleft,
        BZ_Hatswitch_1_up,
        BZ_Hatswitch_1_upright,
        BZ_Hatswitch_1_right,
        BZ_Hatswitch_1_downright,
        BZ_Hatswitch_1_down,
        BZ_Hatswitch_1_downleft,
        BZ_Hatswitch_1_left,
        BZ_Hatswitch_2_upleft,
        BZ_Hatswitch_2_up,
        BZ_Hatswitch_2_upright,
        BZ_Hatswitch_2_right,
        BZ_Hatswitch_2_downright,
        BZ_Hatswitch_2_down,
        BZ_Hatswitch_2_downleft,
        BZ_Hatswitch_2_left,
        BZ_Hatswitch_3_upleft,
        BZ_Hatswitch_3_up,
        BZ_Hatswitch_3_upright,
        BZ_Hatswitch_3_right,
        BZ_Hatswitch_3_downright,
        BZ_Hatswitch_3_down,
        BZ_Hatswitch_3_downleft,
        BZ_Hatswitch_3_left,
        BZ_Hatswitch_4_upleft,
        BZ_Hatswitch_4_up,
        BZ_Hatswitch_4_upright,
        BZ_Hatswitch_4_right,
        BZ_Hatswitch_4_downright,
        BZ_Hatswitch_4_down,
        BZ_Hatswitch_4_downleft,
        BZ_Hatswitch_4_left,
        LastButton  // special marker that must be last
    };
    enum
    {
        ShiftKey = 1,
        ControlKey = 2,
        AltKey = 4
    };

    char        ascii;
    int         button;
    int         shift;
};

class BzfEvent
{
public:
    enum Type
    {
        Unset,
        Quit,
        Redraw,
        Resize,
        Map,
        Unmap,
        MouseMove,
        KeyUp,
        KeyDown
    };

    Type        type;
    BzfWindow*      window;
    union
    {
public:
        BzfQuitEvent    quit;
        BzfResizeEvent  resize;
        BzfMotionEvent  mouseMove;
        BzfMapEvent map;
        BzfUnmapEvent   unmap;
        BzfKeyEvent keyUp;
        BzfKeyEvent keyDown;
    };
    BzfEvent() :
        type(Unset),
        window((BzfWindow*)NULL)
    {
        mouseMove.x=mouseMove.y=resize.width=resize.height=keyUp.ascii=keyUp.button=keyUp.shift=0;
    }
};

#endif /* BZF_EVENT_H */

// Local Variables: ***
// mode: C++ ***
// tab-width: 4 ***
// c-basic-offset: 4 ***
// indent-tabs-mode: nil ***
// End: ***
// ex: shiftwidth=4 tabstop=4