]> icculus.org git repositories - btb/d2x.git/blob - input/sdl_event.c
configuration fixes
[btb/d2x.git] / input / sdl_event.c
1 // SDL Event related stuff
2
3 #include <conf.h>
4
5 #ifdef SDL_INPUT
6 #include <stdio.h>
7 #include <stdlib.h>
8
9 #include <SDL/SDL.h>
10
11 extern void key_handler(SDL_KeyboardEvent *event);
12 //added on 10/17/98 by Hans de Goede for mouse functionality
13 extern void mouse_button_handler(SDL_MouseButtonEvent *mbe);
14 extern void mouse_motion_handler(SDL_MouseMotionEvent *mme);
15 //end this section addition - Hans
16
17 static int initialised=0;
18
19 void event_poll()
20 {
21  SDL_Event event;
22  while (SDL_PollEvent(&event))
23  {
24 // if( (event.type == SDL_KEYEVENT) {
25 //added/changed on 10/17/98 by Hans de Goede for mouse functionality
26 //-killed-   if( (event.type == SDL_KEYDOWN) || (event.type == SDL_KEYUP) ) {
27    switch(event.type)
28    {
29     case SDL_KEYDOWN:
30     case SDL_KEYUP:
31      key_handler((SDL_KeyboardEvent *)&event);
32      break;
33     case SDL_MOUSEBUTTONDOWN:
34     case SDL_MOUSEBUTTONUP:
35      mouse_button_handler((SDL_MouseButtonEvent *)&event);
36      break;
37     case SDL_MOUSEMOTION:
38      mouse_motion_handler((SDL_MouseMotionEvent *)&event);
39      break;
40 //-killed-     return;
41 //end this section addition/change - Hans
42     case SDL_QUIT: {
43 //      void quit_request();
44 //      quit_request();
45     } break;
46    }
47  }
48 }
49
50 int event_init()
51 {
52  // We should now be active and responding to events.
53  initialised = 1;
54
55  return 0;
56 }
57
58 #endif