protected override void TouchCore(ref TouchHandlerParams _params) { PlayOrContinueButton.Touch(ref _params); LevelSelectButton.Touch(ref _params); //OptionsButton.Touch(ref _params); ExitButton?.Touch(ref _params); }
protected override void TouchCore(ref TouchHandlerParams _params) { if (_params.Handled) { return; } if (!_params.IsGestureAvailable) { return; } _params.Handled = true; switch (_params.Gesture.GestureType) { case GestureType.Tap: OnClick(_params.Gesture.Position); break; case GestureType.FreeDrag: m_area.Drag(new Vector2(0, _params.Gesture.Delta.Y)); break; case GestureType.DragComplete: case GestureType.Pinch: case GestureType.PinchComplete: break; default: break; } }
public void Touch(ref TouchHandlerParams _params) { if (_params.Handled) { return; } if (!_params.IsGestureAvailable) { return; } if (_params.Gesture.GestureType != GestureType.Tap) { return; } if (!GetBoundingBox().Contains(_params.Gesture.Position)) { return; } _params.Handled = true; OnClick(); }
protected override void TouchCore(ref TouchHandlerParams _params) { RestartButton.Touch(ref _params); LevelSelectButton.Touch(ref _params); MainMenuButton.Touch(ref _params); ExitButton?.Touch(ref _params); BackButton.Touch(ref _params); }
void OnPinch(TouchHandlerParams _params) { const int pitchScaleStepMultiplier = 5; var oldPosition1 = _params.Gesture.Position - _params.Gesture.Delta; var oldPosition2 = _params.Gesture.Position2 - _params.Gesture.Delta2; var newDistance = Vector2.Distance(_params.Gesture.Position, _params.Gesture.Position2); var oldDistance = Vector2.Distance(oldPosition1, oldPosition2); m_pitchDelta += newDistance - oldDistance; var scaleBorder = m_scaleStep * pitchScaleStepMultiplier; if (Math.Abs(m_pitchDelta) >= scaleBorder) { int newScaleSideSize = m_scaleSideSize + Math.Sign(m_pitchDelta) * m_scaleStep; m_pitchDelta = m_pitchDelta % scaleBorder; if (newScaleSideSize < m_minScale) { newScaleSideSize = m_minScale; } else if (newScaleSideSize > m_maxScale) { newScaleSideSize = m_maxScale; } if (!m_area.CanScaleTo((float)newScaleSideSize / m_sideSize)) { return; } m_scaleSideSize = newScaleSideSize; var positionDiff = _params.Gesture.Position2 - _params.Gesture.Position; var positionMidpoint = positionDiff * 0.5f; var positionFullMidpoint = positionMidpoint + _params.Gesture.Position; m_area.Scale(positionFullMidpoint, (float)m_scaleSideSize / m_sideSize); } }
protected override void TouchCore(ref TouchHandlerParams _params) { MenuButton.Touch(ref _params); if (_params.Handled) { return; } if (!_params.IsGestureAvailable) { return; } _params.Handled = true; switch (_params.Gesture.GestureType) { case GestureType.Tap: OnClick(_params.Gesture.Position); break; case GestureType.FreeDrag: m_area.Drag(_params.Gesture.Delta); break; case GestureType.Pinch: OnPinch(_params); break; case GestureType.PinchComplete: m_pitchDelta = 0; break; default: break; } }
protected override void TouchCore(ref TouchHandlerParams _params) { LevelsListView.Touch(ref _params); BackButton.Touch(ref _params); }