Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
key_down_event.h
Go to the documentation of this file.
1 #ifndef KEY_DOWN_EVENT_H
2 #define KEY_DOWN_EVENT_H
3 #include <glm/glm.hpp>
4 #include "events/event.h"
5 #include "events/event_type.h"
6 //= SCRIPTABLE
7 //= SCRIPTABLE BASES Event
8 
9 namespace Input {
13  class KeyDownEvent : public Events::Event {
14  private:
15  int key;
16  public:
17  //= BEGIN SCRIPTABLE
18 
24  KeyDownEvent(const int key) : Event(Events::EventType::KEY_DOWN), key(key) {}
32  static std::shared_ptr<KeyDownEvent> create(const int key) { return std::make_shared<KeyDownEvent>(key); }
38  int getKey() const noexcept { return key; }
39  //= END SCRIPTABLE
40  };
41 }
42 
43 #endif
Definition: event_type.h:19
KeyDownEvent(const int key)
Constructor for KeyDownEvent.
Definition: key_down_event.h:24
static std::shared_ptr< KeyDownEvent > create(const int key)
Factory function.
Definition: key_down_event.h:32
Class for event.
Definition: event.h:10
EventType
Event type enum that is used when passing events.
Definition: event_type.h:12
int getKey() const noexcept
Gets the key.
Definition: key_down_event.h:38
Class for key down event.
Definition: key_down_event.h:13
Event(const EventType &type)
Event constructor.
Definition: event.h:21