ShishGL  1.0
A simple modular cross-platform graphics library
Event.hpp
Go to the documentation of this file.
1 /*============================================================================*/
2 #ifndef SHISHGL_EVENT_HPP
3 #define SHISHGL_EVENT_HPP
4 /*============================================================================*/
5 #include <cstdint>
6 
7 #include "Listener.hpp"
8 /*============================================================================*/
9 namespace Sh {
10 
11  typedef uint64_t EventMask;
12 
13  static constexpr EventMask
14  NONE = 0ULL,
15  TIMER = 1ULL << 0ULL,
16  MOUSE_MOVE = 1ULL << 1ULL,
17  MOUSE_BUTTON = 1ULL << 2ULL,
18  MOUSE_SCROLL = 1ULL << 3ULL,
19  MOUSE = MOUSE_SCROLL | MOUSE_BUTTON | MOUSE_MOVE,
20  KEYBOARD = 1ULL << 4ULL,
21  SLIDE = 1ULL << 5ULL,
22  ALL = ~NONE;
23 
24  /*------------------------------------------------------------------------*/
25 
26  class Event {
27  public:
28 
29  [[nodiscard]]
30  bool isReceived() const;
31 
32  protected:
33 
34  Event();
35 
36  virtual bool happen(Listener* listener) = 0;
37 
38  virtual EventMask mask();
39 
40  virtual ~Event() = default;
41 
42  private:
43 
44  bool received;
45 
46  friend class EventSystem;
47  friend class EventManager;
48  };
49 
50 }
51 /*============================================================================*/
52 #endif //SHISHGL_EVENT_HPP
53 /*============================================================================*/
Sh::Event::~Event
virtual ~Event()=default
Sh::Event
Definition: Event.hpp:26
Sh::EventManager
Definition: EventManager.hpp:12
Sh::EventSystem
Definition: EventSystem.hpp:9
Sh
Definition: CoreApplication.hpp:10
Sh::Event::Event
Event()
Definition: Event.cpp:7
Sh::Event::mask
virtual EventMask mask()
Definition: Event.cpp:19
Sh::Event::happen
virtual bool happen(Listener *listener)=0
Listener.hpp
Sh::Listener
Definition: Listener.hpp:7
Sh::Event::isReceived
bool isReceived() const
Definition: Event.cpp:13
Sh::EventMask
uint64_t EventMask
Definition: Event.hpp:11