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