File: ecl_sdl.cc

package info (click to toggle)
enigma 1.20-dfsg.1-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 64,620 kB
  • ctags: 16,428
  • sloc: xml: 153,614; cpp: 63,581; ansic: 31,088; sh: 4,825; makefile: 1,858; yacc: 288; perl: 84; sed: 16
file content (40 lines) | stat: -rw-r--r-- 777 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "ecl_sdl.hh"

using namespace sdl;

// Dispatch an event to the suitable virtual function. Returns
// true if event was handled.
bool
EventHandler::dispatch_event(SDL_Event &e)
{
    bool handled = false;
    
    switch (e.type) {
    case SDL_KEYDOWN:
        handled=on_keydown(e); break;
    case SDL_KEYUP:
        handled=on_keyup(e); break;
    case SDL_MOUSEMOTION: 
        handled=on_mousemotion(e); break;
    case SDL_MOUSEBUTTONDOWN:
    case SDL_MOUSEBUTTONUP:
        handled=on_mousebutton(e);
        break;
    case SDL_ACTIVEEVENT:
        // TODO
        break;
    case SDL_QUIT:
        handled=on_quit(e); break;
    }
    return handled || on_event(e);
}

void 
sdl::FlushEvents()
{
    SDL_Event e;
    while (SDL_PollEvent(&e))
        ;
}