コード例 #1
0
        private void DoMouseDown(byte button, int x, int y)
        {
            //
            // OS X Sierra issue: we get mousedown events when the window title
            // is clicked, sometimes.  These always show up with a Y coordinate
            // of zero.  So ignore those only for mouse-capture purposes as
            // a workaround.
            //
            if (!_mouseCaptured && (x <= 0 || y <= 0))
            {
                return;
            }

            if (!_mouseCaptured)
            {
                return;
            }

            StarMouseButton starButton = GetMouseButtonSDL(button);

            if (starButton != StarMouseButton.None)
            {
                _system.IOP.Mouse.MouseDown(starButton);
            }
        }
コード例 #2
0
        private void OnWinformsMouseDown(object sender, MouseEventArgs e)
        {
            if (!_mouseCaptured)
            {
                return;
            }

            StarMouseButton starButton = GetMouseButtonWinforms(e.Button);

            if (starButton != StarMouseButton.None)
            {
                _system.IOP.Mouse.MouseDown(starButton);
            }
        }
コード例 #3
0
        private void DoMouseUp(byte button)
        {
            if (!_mouseCaptured)
            {
                CaptureMouse();
                return;
            }

            StarMouseButton starButton = GetMouseButtonSDL(button);

            if (starButton != StarMouseButton.None)
            {
                _system.IOP.Mouse.MouseUp(starButton);
            }
        }
コード例 #4
0
        /// <summary>
        /// Maps the Winforms mouse button to the Star's mouse button.
        /// </summary>
        /// <param name="button"></param>
        /// <returns></returns>
        private static StarMouseButton GetMouseButtonWinforms(MouseButtons button)
        {
            StarMouseButton starButton = StarMouseButton.None;

            switch (button)
            {
            case MouseButtons.Left:
                starButton = StarMouseButton.Left;
                break;

            case MouseButtons.Middle:
                starButton = StarMouseButton.Middle;
                break;

            case MouseButtons.Right:
                starButton = StarMouseButton.Right;
                break;
            }

            return(starButton);
        }
コード例 #5
0
        /// <summary>
        /// Maps the SDL mouse button to the Star's mouse button.
        /// </summary>
        /// <param name="button"></param>
        /// <returns></returns>
        private static StarMouseButton GetMouseButtonSDL(byte button)
        {
            StarMouseButton starButton = StarMouseButton.None;

            switch (button)
            {
            case 1:
                starButton = StarMouseButton.Left;
                break;

            case 2:
                starButton = StarMouseButton.Middle;
                break;

            case 3:
                starButton = StarMouseButton.Right;
                break;
            }

            return(starButton);
        }
コード例 #6
0
ファイル: Mouse.cs プロジェクト: sgnls/Darkstar
 public void MouseUp(StarMouseButton button)
 {
     _buttons &= (~button);
 }
コード例 #7
0
ファイル: Mouse.cs プロジェクト: sgnls/Darkstar
 public void MouseDown(StarMouseButton button)
 {
     _buttons |= button;
 }