My Project
TouchSessions.h
1 #pragma once
2 
3 namespace ParaEngine
4 {
5  class TouchEventSession;
6  class CTouchGestureBase;
7  struct TouchEvent;
8 
12  {
13  public:
14  TouchSessions();
15  ~TouchSessions();
16 
18  static TouchSessions& GetInstance();
19 
20  int GetSessionCount();
21 
23  TouchEventSession* operator [] (int nIndex);
24 
26  TouchEventSession* GetTouchSession(int nTouchId);
27 
28  void AddToTouchSession(const TouchEvent &touch);
29 
30  void ClearTouchSessions();
31 
32  void TickTouchSessions();
33 
38  bool InterpreteTouchGestures(const TouchEvent* touch);
39 
40  void RegisterGestureRecognizer(CTouchGestureBase* gesture);
41 
42  void CleanupAllGestures();
43  public:
45  std::map<int, TouchEventSession*> m_touch_sessions;
46  std::vector<TouchEventSession*> m_touch_arrays;
50  std::vector<CTouchGestureBase*> gestures;
51  };
52 }
53 
Definition: TouchGestureBase.h:8
static TouchSessions & GetInstance()
singleton object
Definition: TouchSessions.cpp:26
different physics engine has different winding order.
Definition: EventBinding.h:32
TouchEventSession * operator[](int nIndex)
get touch session by index.
Definition: TouchSessions.cpp:46
it tracks touch events with same id, and expires when a touch is too long.
Definition: TouchEventSession.h:7
touch event
Definition: EventClasses.h:118
CTouchGestureBase * activeGesture
current active gesture
Definition: TouchSessions.h:48
std::map< int, TouchEventSession * > m_touch_sessions
mapping from touch id to touch session.
Definition: TouchSessions.h:45
bool InterpreteTouchGestures(const TouchEvent *touch)
return true if at least one gesture is recognized.
Definition: TouchSessions.cpp:137
TouchEventSession * GetTouchSession(int nTouchId)
get touch session by touch id.
Definition: TouchSessions.cpp:51
manages all global touch sessions.
Definition: TouchSessions.h:11
std::vector< CTouchGestureBase * > gestures
all registered gestures
Definition: TouchSessions.h:50