*in progress*
[winnie] / src / sdl / event.cc
1 #ifdef WINNIE_SDL
2 #include <stdlib.h>
3 #include <SDL/SDL.h>
4
5 #include "event.h"
6 #include "keyboard.h"
7 #include "mouse.h"
8 #include "wm.h"
9
10 SDL_Event sdl_event;
11 void process_events()
12 {
13         wm->process_windows();
14         if(!SDL_WaitEvent(&sdl_event)) {
15                 return;
16         }
17
18         switch(sdl_event.type) {
19         case SDL_KEYDOWN:
20         case SDL_KEYUP:
21                 process_keyboard_event();
22                 break;
23         case SDL_MOUSEMOTION:
24         case SDL_MOUSEBUTTONDOWN:
25         case SDL_MOUSEBUTTONUP:
26                 process_mouse_event();
27                 break;
28         case SDL_QUIT:
29                 exit(0);
30         }
31 }
32
33 #endif // WINNIE_SDL