SDL++
C++wrapperfortheSDLlibrary.

event/KeyboardEvents.h

Go to the documentation of this file.
00001 
00021 #ifndef SDL_EVENT_KEYBOARDEVENTS_H
00022 #define SDL_EVENT_KEYBOARDEVENTS_H
00023 
00024 #include <SDL.h>
00025 
00026 #include "sdlpp/event/Components.h"
00027 #include "sdlpp/event/MultiComparator.h"
00028 #include "sdlpp/event/SimpleComparator.h"
00029 #include "sdlpp/event/Event.h"
00030 
00031 namespace sdl {
00032 namespace event {
00033     using namespace misc;
00034 
00039     struct KeyBase : public EventBase {
00045         KeyBase (const SDL_Event* event) : EventBase (event) {};
00046 
00052         const SDL_KeyboardEvent& get () const { return event_->key; };
00053 
00059         const SDL_KeyboardEvent& get () { return event_->key; };
00060     }; //KeyBase
00061 
00068     template<int... Keys>
00069     struct KeyPress : public Event<MultiComparator<Key, SDL_KEYDOWN, Keys...>, KeyBase> {
00075         explicit KeyPress (const SDL_Event* event = 0) : Event<MultiComparator<Key, SDL_KEYDOWN, Keys...>, KeyBase> (event) {};
00076     }; //KeyPress
00077 
00082     typedef Event<SimpleComparator<SDL_KEYDOWN>, KeyBase> AnyKeyPress;
00083     
00090     template<int... Keys>
00091     struct KeyRelease : public Event<MultiComparator<Key, SDL_KEYUP, Keys...>, KeyBase> {
00097         explicit KeyRelease (const SDL_Event* event = 0) : Event<MultiComparator<Key, SDL_KEYUP, Keys...>, KeyBase> (event) {};
00098     }; //KeyRelease
00099 
00104     typedef Event<SimpleComparator<SDL_KEYUP>, KeyBase> AnyKeyRelease;
00105 }; //event
00106 }; //sdl
00107 
00108 #endif //SDL_EVENT_KEYBOARDEVENTS_H
00109 
 All Classes Namespaces Files Functions Variables Typedefs