Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- orxSTATUS orxFASTCALL MenuInputComponent::EventHandler (const orxEVENT *evt)
- {
- orxSTATUS result = orxSTATUS_SUCCESS;
- if (evt->eType == orxEVENT_TYPE_SYSTEM)
- {
- orxSYSTEM_EVENT_PAYLOAD *payload =
- (orxSYSTEM_EVENT_PAYLOAD *) evt->pstPayload;
- orxVECTOR coords = { payload->stTouch.fX, payload->stTouch.fY, 0 };
- if (evt->eID == orxSYSTEM_EVENT_TOUCH_BEGIN)
- {
- //Input::Touch::SetTouchStart (coords);
- }
- else if (evt->eID == orxSYSTEM_EVENT_TOUCH_MOVE)
- {
- Input::Touch::SetTouchMove (coords);
- }
- else if (evt->eID == orxSYSTEM_EVENT_TOUCH_END)
- {
- /*
- const orxVECTOR *touchStart = Input::Touch::GetTouchStart ();
- const orxVECTOR *touchMove = Input::Touch::GetTouchMove ();
- orxVECTOR moveDistance;
- orxVector_Sub (&moveDistance, touchStart, touchMove);
- float swipeThreshold = Input::Touch::GetSwipeThreshold ();
- // Finger moved during touch and exceeded swipe gesture threshold?
- if ((touchMove->fX > 0 && touchMove->fY > 0) &&
- (fabs (moveDistance.fX) > swipeThreshold ||
- fabs (moveDistance.fY) > swipeThreshold))
- {
- orxSWIPE_EVENT_PAYLOAD payload;
- payload.swipePath = moveDistance;
- orxEVENT orxSWIPE_EVENT;
- orxSWIPE_EVENT.eID = orxSWIPE;
- orxSWIPE_EVENT.eType = orxEVENT_TYPE_USER_DEFINED;
- orxSWIPE_EVENT.pstPayload = (void *) &payload;
- orxEvent_Send (&orxSWIPE_EVENT);
- }
- */
- }
- }
- else if (evt->eType == orxEVENT_TYPE_USER_DEFINED)
- {
- if (evt->eID == orxSWIPE)
- {
- orxSWIPE_EVENT_PAYLOAD *payload =
- reinterpret_cast<orxSWIPE_EVENT_PAYLOAD *> (evt->pstPayload);
- // Swiped right?
- if (payload->swipePath.fX < 0)
- {
- const char *target = "O-AllLevelIcons";
- orxOBJECT *targetObj = orxObject_GetByName (target);
- orxObject_AddFX (targetObj, "FX-SlideRight");
- }
- // Swiped left?
- else if (payload->swipePath.fX > 0)
- {
- const char *target = "O-AllLevelIcons";
- orxOBJECT *targetObj = orxObject_GetByName (target);
- orxObject_AddFX (targetObj, "FX-SlideLeft");
- }
- }
- }
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment