1 /***************************************************************************
2                           event.h  -  description
3                              -------------------
4     begin                : Wed Mar 20 2002
5     copyright            : (C) 2001 by Michael Speck
6     email                : kulkanie@gmx.net
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef __EVENT_H
19 #define __EVENT_H
20 
21 /*
22 ====================================================================
23 Event filter. As long as this is active no KEY or MOUSE events
24 will be available by SDL_PollEvent().
25 ====================================================================
26 */
27 int event_filter( const SDL_Event *event );
28 
29 /*
30 ====================================================================
31 Enable/Disable event filtering of mouse and keyboard.
32 ====================================================================
33 */
34 void event_enable_filter( void );
35 void event_disable_filter( void );
36 void event_clear( void );
37 
38 /*
39 ====================================================================
40 Check if an motion event occured since last call.
41 ====================================================================
42 */
43 int event_get_motion( int *x, int *y );
44 /*
45 ====================================================================
46 Check if a button was pressed and return its value and the current
47 mouse position.
48 ====================================================================
49 */
50 int event_get_buttondown( int *button, int *x, int *y );
51 int event_get_buttonup( int *button, int *x, int *y );
52 
53 /*
54 ====================================================================
55 Get current cursor position.
56 ====================================================================
57 */
58 void event_get_cursor_pos( int *x, int *y );
59 
60 /*
61 ====================================================================
62 Check if 'button' button is currently set.
63 ====================================================================
64 */
65 enum {
66     BUTTON_NONE = 0,
67     BUTTON_LEFT,
68     BUTTON_MIDDLE,
69     BUTTON_RIGHT,
70     WHEEL_UP,
71     WHEEL_DOWN
72 };
73 int event_check_button( int button );
74 
75 /*
76 ====================================================================
77 Check if 'key' is currently set.
78 ====================================================================
79 */
80 int event_check_key( int key );
81 
82 /*
83 ====================================================================
84 Check if SDL_QUIT was received.
85 ====================================================================
86 */
87 int event_check_quit();
88 
89 /*
90 ====================================================================
91 Clear the SDL event key (keydown events)
92 ====================================================================
93 */
94 void event_clear_sdl_queue();
95 
96 /*
97 ====================================================================
98 Wait until neither a key nor a button is pressed.
99 ====================================================================
100 */
101 void event_wait_until_no_input();
102 
103 #endif
104