]> icculus.org git repositories - btb/d2x.git/blob - arch/sdl/event.c
use the orientation parameter of g3_draw_bitmap
[btb/d2x.git] / arch / sdl / event.c
1 /*
2  *
3  * SDL Event related stuff
4  *
5  *
6  */
7
8 #ifdef HAVE_CONFIG_H
9 #include <conf.h>
10 #endif
11
12 #include <stdio.h>
13 #include <stdlib.h>
14
15 #include <SDL.h>
16
17 extern void key_handler(SDL_KeyboardEvent *event);
18 extern void mouse_button_handler(SDL_MouseButtonEvent *mbe);
19 extern void mouse_motion_handler(SDL_MouseMotionEvent *mme);
20 #ifndef USE_LINUX_JOY // stpohle - so we can choose at compile time..
21 extern void joy_button_handler(SDL_JoyButtonEvent *jbe);
22 extern void joy_hat_handler(SDL_JoyHatEvent *jhe);
23 extern void joy_axis_handler(SDL_JoyAxisEvent *jae);
24 #endif
25
26 static int initialised=0;
27
28 void event_poll()
29 {
30         SDL_Event event;
31
32         while (SDL_PollEvent(&event)) {
33                 switch(event.type) {
34                 case SDL_KEYDOWN:
35                 case SDL_KEYUP:
36                         key_handler((SDL_KeyboardEvent *)&event);
37                         break;
38                 case SDL_MOUSEBUTTONDOWN:
39                 case SDL_MOUSEBUTTONUP:
40                         mouse_button_handler((SDL_MouseButtonEvent *)&event);
41                         break;
42                 case SDL_MOUSEMOTION:
43                         mouse_motion_handler((SDL_MouseMotionEvent *)&event);
44                         break;
45 #ifndef USE_LINUX_JOY       // stpohle - so we can choose at compile time..
46                 case SDL_JOYBUTTONDOWN:
47                 case SDL_JOYBUTTONUP:
48                         joy_button_handler((SDL_JoyButtonEvent *)&event);
49                         break;
50                 case SDL_JOYAXISMOTION:
51                         joy_axis_handler((SDL_JoyAxisEvent *)&event);
52                         break;
53                 case SDL_JOYHATMOTION:
54                         joy_hat_handler((SDL_JoyHatEvent *)&event);
55                         break;
56                 case SDL_JOYBALLMOTION:
57                         break;
58 #endif
59                 case SDL_QUIT: {
60                         void quit_request(void);
61                         quit_request();
62                 } break;
63                 }
64         }
65 }
66
67 int event_init()
68 {
69         // We should now be active and responding to events.
70         initialised = 1;
71
72         return 0;
73 }