rag
graphic 2d engine
KeyboardEvent.h
1 #ifndef Rag_KeyboardEvent_h
2 #define Rag_KeyboardEvent_h
3 
4 #include <rag/Event.h>
5 #include <sstream>
6 
7 namespace events
8 {
9  static const std::string KEY_DOWN = "KeyDown";
10  static const std::string KEY_UP = "KeyUp";
11 
13  class KeyboardEvent: public Event
14  {
15  public:
16 
17  KeyboardEvent(std::string type): Event(type) {};
18 
19  std::string key;
20  int charCode;
21 
23  virtual std::string toString()
24  {
25  std::ostringstream oss;
26  oss << "(key = " << key << ", charCode=" << charCode << ")";
27  return oss.str();
28  }
29  };
30 }
31 
32 #endif
virtual std::string toString()
String representation of the event.
Definition: KeyboardEvent.h:23
Base class for event system.
Definition: Event.h:24
int charCode
Character code.
Definition: KeyboardEvent.h:20
std::string key
Key pressed, encoded in UTF-8.
Definition: KeyboardEvent.h:17
std::string type
The type of the event. The string should be unique for this event.
Definition: Event.h:36
Definition: Event.h:11
Event to handle KeyBoard actions.
Definition: KeyboardEvent.h:13