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