Implements SimpleGUI events from a TouchScreen
Dependents: TouchScreenGUIDemo
Revision 5:e3084e17e8e6, committed 2016-05-28
- Comitter:
- duncanFrance
- Date:
- Sat May 28 14:50:49 2016 +0000
- Parent:
- 4:0be0d6a61e90
- Commit message:
- Removed dependency on GUI
Changed in this revision
TouchScreenEventSource.cpp | Show annotated file Show diff for this revision Revisions of this file |
TouchScreenEventSource.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0be0d6a61e90 -r e3084e17e8e6 TouchScreenEventSource.cpp --- a/TouchScreenEventSource.cpp Tue May 17 16:28:53 2016 +0000 +++ b/TouchScreenEventSource.cpp Sat May 28 14:50:49 2016 +0000 @@ -6,8 +6,8 @@ * tap and double-tap events **/ -TouchScreenEventSource::TouchScreenEventSource(TouchScreen* touchScreen, GUI* gui) -: EventSource(gui), _touchScreen(touchScreen), _state(Idle) +TouchScreenEventSource::TouchScreenEventSource(TouchScreen* touchScreen, EventDispatcher* dispatcher) +: EventSource(dispatcher), _touchScreen(touchScreen), _state(Idle) { _touchScreen->setTouchStartHandler(this, &TouchScreenEventSource::touchStartHandler); _touchScreen->setTouchEndHandler(this, &TouchScreenEventSource::touchEndHandler); @@ -26,7 +26,7 @@ e.screenX = p.screenX; e.screenY = p.screenY; e.type = TOUCH_START; - _gui->queueEvent(e); + _eventDispatcher->queueEvent(e); } void TouchScreenEventSource::touchMoveHandler(TouchPosition p) @@ -36,7 +36,7 @@ e.screenX = p.screenX; e.screenY = p.screenY; e.type = TOUCH_MOVE; - _gui->queueEvent(e); + _eventDispatcher->queueEvent(e); } void TouchScreenEventSource::touchEndHandler(TouchPosition p) @@ -71,10 +71,10 @@ tapped = true; } - _gui->queueEvent(endEvent); + _eventDispatcher->queueEvent(endEvent); if(tapped) { - _gui->queueEvent(tapEvent); + _eventDispatcher->queueEvent(tapEvent); } }
diff -r 0be0d6a61e90 -r e3084e17e8e6 TouchScreenEventSource.h --- a/TouchScreenEventSource.h Tue May 17 16:28:53 2016 +0000 +++ b/TouchScreenEventSource.h Sat May 28 14:50:49 2016 +0000 @@ -20,7 +20,7 @@ { public: - TouchScreenEventSource(TouchScreen* touchScreen, GUI* gui); + TouchScreenEventSource(TouchScreen* touchScreen, EventDispatcher* dispatcher); void touchStartHandler(TouchPosition p); void touchMoveHandler(TouchPosition p);