// SDL wrappers & helper classes // Copyright (C) 2002 Daniel Heck #ifndef PX_SDL_HH #define PX_SDL_HH #include "SDL.h" namespace sdl { class EventHandler { public: virtual ~EventHandler() {} // Dispatch an event to the suitable virtual function. Returns // true if event was handled. bool dispatch_event(SDL_Event &e); // The following function can be overriden to receive // particular events. They should return true if the event // was actually handled. virtual bool on_mousemotion(SDL_Event &e) { return false; } virtual bool on_mousebutton(SDL_Event &e) { return false; } virtual bool on_keydown(SDL_Event &e) { return false; } virtual bool on_keyup(SDL_Event &e) { return false; } virtual bool on_quit(SDL_Event &e) { return false; } // The generic event handler; this method is called for events // that none of the specialized methods above decided to handle. virtual bool on_event(SDL_Event &e) { return false; } }; } #endif