Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
eventpoll.h
1 #pragma once
2 
3 #include <functional>
4 #include <memory>
5 
6 #include "scripting/scriptable.h"
7 
8 #include "utils/handle/handle.h"
9 
10 
11 class EventPoll: public Scriptable {
12 public:
13  EventPoll(const std::function<void()>& callback);
14  ~EventPoll();
15 
16  /*
17  Return true if the poll won't fire anymore
18  */
19  virtual bool isDead();
20 
21  virtual void update(float deltaSec);
22 
23  bool isActive() const;
24  void setActive(bool active);
25 
26  Handle<EventPoll>& handle();
27 
28 
29 protected:
30  std::function<void()> m_callback;
31  Handle<EventPoll> m_handle;
32  bool m_active;
33 
34  void doCallback();
35  virtual bool poll() = 0;
36  virtual void specialOnCallback();
37 };
38 
Definition: eventpoll.h:11
Definition: scriptable.h:4