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); } }
private void OnWinformsMouseDown(object sender, MouseEventArgs e) { if (!_mouseCaptured) { return; } StarMouseButton starButton = GetMouseButtonWinforms(e.Button); if (starButton != StarMouseButton.None) { _system.IOP.Mouse.MouseDown(starButton); } }
private void DoMouseUp(byte button) { if (!_mouseCaptured) { CaptureMouse(); return; } StarMouseButton starButton = GetMouseButtonSDL(button); if (starButton != StarMouseButton.None) { _system.IOP.Mouse.MouseUp(starButton); } }
/// <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); }
/// <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); }
public void MouseUp(StarMouseButton button) { _buttons &= (~button); }
public void MouseDown(StarMouseButton button) { _buttons |= button; }