Begin Repo
This commit is contained in:
28
events/keyEvent.h
Normal file
28
events/keyEvent.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "terminal.h"
|
||||
#include "event.h"
|
||||
|
||||
class KeyEvent : public Event {
|
||||
const int key;
|
||||
const int scancode;
|
||||
const int mod;
|
||||
const int repeat;
|
||||
const bool pressed;
|
||||
public:
|
||||
KeyEvent(int, int, int, int, bool);
|
||||
inline int getKey() const { return key; }
|
||||
inline int getScancode() const { return scancode; }
|
||||
inline int getMod() const { return mod; }
|
||||
inline bool getPressed() const { return pressed; }
|
||||
EventType getType() const { return pressed ? EventType::KeyPressed : EventType::KeyReleased; }
|
||||
};
|
||||
|
||||
class KeyTypedEvent : public Event {
|
||||
const std::string text;
|
||||
const int windowID;
|
||||
|
||||
public:
|
||||
KeyTypedEvent(int, char*);
|
||||
inline int getWindowID() const { return windowID; }
|
||||
inline const char* getText() const { return text.c_str(); }
|
||||
EventType getType() const { return EventType::KeyTyped; }
|
||||
};
|
||||
Reference in New Issue
Block a user