Untitled Game engine no.5  1.0
Event.hpp
1 #ifndef EVENT_HPP
2 #define EVENT_HPP
3 
4 #include "pch.hpp"
5 
6 namespace Engine {
7 
11  enum class EventType {
12  None = 0,
13  WindowClose, WindowResize, WindowFocus, WindowLostFocus, WindowMoved,
14  KeyPressed, KeyReleased,
15  MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseScrolled,
16  };
17 
22  None = 0,
23  EventCatApplication = BIT(0),
24  EventCatInput = BIT(1),
25  EventCatKeyboard = BIT(2),
26  EventCatMouse = BIT(3),
27  EventCatMouseButton = BIT(4),
28  };
29 
33  class Event {
34  friend class EventDispatcher;
35 
36  public:
37  virtual EventType GetEventType() const = 0;
38  virtual const char* GetName() const = 0;
39  virtual int GetFlag() const = 0;
40  virtual std::string ToString() const { return GetName(); }
41 
42  inline bool IsCategory(EventCategorty cat) {
43  return GetFlag() & cat;
44  }
45 
46  protected:
47  bool m_Handled;
48  };
49 
54 
55  };
56 
57 }
58 #endif
Engine::EventDispatcher
Definition: Event.hpp:53
Engine::EventType
EventType
Definition: Event.hpp:11
Engine::Event
Definition: Event.hpp:33
Engine
Definition: Animation.hpp:14
Engine::EventCategorty
EventCategorty
Definition: Event.hpp:21