Beispiel #1
0
        public override void Mouse(MouseHandlerParams _params)
        {
            if (!Visible)
            {
                return;
            }

            if (!IsProcessInput)
            {
                return;
            }

            if (_params.Handled)
            {
                return;
            }

            if (!m_canvasSprite.GetBoundingBoxNoRotation().Contains(_params.Position))
            {
                return;
            }

            m_mouseParams.CopyFrom(_params, new Vector2(-(m_canvasSprite.X - m_canvasSprite.OriginX), -(m_canvasSprite.Y - m_canvasSprite.OriginY)));

            MouseCore(m_mouseParams);

            _params.Handled = m_mouseParams.Handled;
        }
Beispiel #2
0
        public InputWorker()
        {
            TouchPanel.EnabledGestures = GestureType.Tap
                                         | GestureType.FreeDrag | GestureType.DragComplete
                                         | GestureType.Pinch | GestureType.PinchComplete;

            m_prevKeysSet    = new HashSet <Keys>();
            m_keyboardParams = new KeyboardHandlerParams();
            m_mouseParams    = new MouseHandlerParams();
            m_gamePadParams  = new GamePadHandlerParams();
        }
Beispiel #3
0
 public CanvasScreen(GraphicsDevice device, int width, int height)
 {
     this.m_mouseParams  = new MouseHandlerParams();
     this.IsProcessInput = false;
     CreateCanvas(device, width, height);
     this.m_canvasSprite = new Sprite()
     {
         Texture = this.Canvas.RenderTarget,
         X       = device.Viewport.Width / 2,
         Y       = device.Viewport.Height / 2,
         Visible = this.Visible,
     };
 }
Beispiel #4
0
 public void CopyFrom(MouseHandlerParams mouseParams, Vector2 offset)
 {
     Handled              = mouseParams.Handled;
     IsLeftButtonDown     = mouseParams.IsLeftButtonDown;
     IsRightButtonDown    = mouseParams.IsRightButtonDown;
     IsLeftButtonPressed  = mouseParams.IsLeftButtonPressed;
     IsRightButtonPressed = mouseParams.IsRightButtonPressed;
     IsDrag          = mouseParams.IsDrag;
     PositionX       = mouseParams.PositionX + (int)offset.X;
     PositionY       = mouseParams.PositionY + (int)offset.Y;
     DeltaPositionX  = mouseParams.DeltaPositionX;
     DeltaPositionY  = mouseParams.DeltaPositionY;
     WheelValue      = mouseParams.WheelValue;
     DeltaWheelValue = mouseParams.DeltaWheelValue;
 }
Beispiel #5
0
 protected virtual void MouseCore(MouseHandlerParams _params)
 {
 }
Beispiel #6
0
 public virtual void Mouse(MouseHandlerParams _params)
 {
 }