]> icculus.org git repositories - btb/d2x.git/blob - arch/sdl/event.c
use mouse wheel to emulate 3rd axis
[btb/d2x.git] / arch / sdl / event.c
1 /*
2  * $Source: /cvs/cvsroot/d2x/arch/sdl/event.c,v $
3  * $Revision: 1.3 $
4  * $Author: bradleyb $
5  * $Date: 2001-11-14 10:43:10 $
6  *
7  * SDL Event related stuff
8  *
9  * $Log: not supported by cvs2svn $
10  * Revision 1.2  2001/10/31 07:41:54  bradleyb
11  * Sync with d1x
12  *
13  * Revision 1.1  2001/10/24 09:25:05  bradleyb
14  * Moved input stuff to arch subdirs, as in d1x.
15  *
16  * Revision 1.2  2001/01/29 14:03:57  bradleyb
17  * Fixed build, minor fixes
18  *
19  */
20
21 #ifdef HAVE_CONFIG_H
22 #include <conf.h>
23 #endif
24
25 #include <stdio.h>
26 #include <stdlib.h>
27
28 #include <SDL/SDL.h>
29
30 extern void key_handler(SDL_KeyboardEvent *event);
31 extern void mouse_button_handler(SDL_MouseButtonEvent *mbe);
32 extern void mouse_motion_handler(SDL_MouseMotionEvent *mme);
33
34 static int initialised=0;
35
36 void event_poll()
37 {
38         SDL_Event event;
39
40         while (SDL_PollEvent(&event)) {
41                 switch(event.type) {
42                 case SDL_KEYDOWN:
43                 case SDL_KEYUP:
44                         key_handler((SDL_KeyboardEvent *)&event);
45                         break;
46                 case SDL_MOUSEBUTTONDOWN:
47                 case SDL_MOUSEBUTTONUP:
48                         mouse_button_handler((SDL_MouseButtonEvent *)&event);
49                         break;
50                 case SDL_MOUSEMOTION:
51                         mouse_motion_handler((SDL_MouseMotionEvent *)&event);
52                         break;
53 #if 0
54                 case SDL_JOYBUTTONDOWN:
55                 case SDL_JOYBUTTONUP:
56                         joy_button_handler((SDL_JoyButtonEvent *)&event);
57                         break;
58                 case SDL_JOYAXISMOTION:
59                         joy_motion_handler((SDL_JoyAxisEvent *)&event);
60                         break;
61                 case SDL_JOYBALLMOTION:
62                 case SDL_JOYHATMOTION:
63                         break;
64 #endif
65                 case SDL_QUIT: {
66                         void quit_request();
67                         quit_request();
68                 } break;
69                 }
70         }
71 }
72
73 int event_init()
74 {
75         // We should now be active and responding to events.
76         initialised = 1;
77
78         return 0;
79 }