All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
EmscriptenInputReceiver.h
1 #pragma once
2 
3 #include "Types.h"
4 #include "EmscriptenInputProcessor.h"
5 
6 #include <emscripten/html5.h>
7 
8 #include <set>
9 
10 namespace Eegeo
11 {
12  namespace Emscripten
13  {
14  namespace Input
15  {
17  {
18  public:
19  EmscriptenInputReceiver(EmscriptenInputProcessor& inputProcessor, int canvasWidth, int canvasHeight);
20 
21  void Update(float deltaTimeSeconds);
22 
23  bool MouseCallback(int eventType, const EmscriptenMouseEvent* e, void* userData);
24  bool MouseWheelCallback(int eventType, const EmscriptenWheelEvent* e, void* userData);
25  bool KeyboardCallback(int eventType, const EmscriptenKeyboardEvent* e, void* userData);
26  bool TouchCallback(int eventType, const EmscriptenTouchEvent* e, void* userData);
27 
28  void UpdateResolution(int canvasWidth, int canvasHeight);
29 
30  private:
31  bool PointInCanvas(long x, long y) const;
32 
33  EmscriptenInputProcessor& m_inputProcessor;
34  int m_canvasWidth;
35  int m_canvasHeight;
36  bool m_dragStartedInsideMap;
37  std::set<long> m_touchDragsStartedInsideMap;
38  };
39  }
40  }
41 }