public static TileMouseState FromHwndMouseEventArgs(HwndMouseEventArgs e, Vector2Int32 tile) { return(new TileMouseState { LeftButton = e.LeftButton, RightButton = e.RightButton, MiddleButton = e.MiddleButton, Location = tile }); }
private void HandleMouseEvent(object sender, HwndMouseEventArgs e) { _mouseEventSinceLastUpdate = true; var position = e.GetPosition(_hwndHost); _currentState = new MouseState( (int) position.X, (int) position.Y, e.WheelDelta, MapButtonState(e.LeftButton), MapButtonState(e.MiddleButton), MapButtonState(e.RightButton), MapButtonState(e.X1Button), MapButtonState(e.X2Button)); }
private void HandleMouseEvent(object sender, HwndMouseEventArgs e) { _mouseEventSinceLastUpdate = true; var position = e.GetPosition(_hwndHost); _currentState = new MouseState( (int)position.X, (int)position.Y, e.WheelDelta, MapButtonState(e.LeftButton), MapButtonState(e.MiddleButton), MapButtonState(e.RightButton), MapButtonState(e.X1Button), MapButtonState(e.X2Button)); }
/// <summary> /// Invoked when the mouse moves over the second viewport /// </summary> /// <param name="args"></param> protected override void RaiseHwndMouseMove(HwndMouseEventArgs args) { // If the left or right buttons are down, we adjust the yaw and pitch of the cube if (IsMouseCaptured) { var position = HwndMouse.GetCursorPosition(); _yaw += (float) (position.X - _originalPosition.X) * .01f; _pitch += (float) (position.Y - _originalPosition.Y) * .01f; HwndMouse.SetCursorPosition(_originalPosition); } base.RaiseHwndMouseMove(args); }
/// <summary> /// Invoked when the mouse moves over the second viewport /// </summary> /// <param name="args"></param> protected override void RaiseHwndMouseMove(HwndMouseEventArgs args) { // If the left or right buttons are down, we adjust the yaw and pitch of the cube if (IsMouseCaptured) { var position = HwndMouse.GetCursorPosition(); _yaw += (float)(position.X - _originalPosition.X) * .01f; _pitch += (float)(position.Y - _originalPosition.Y) * .01f; HwndMouse.SetCursorPosition(_originalPosition); } base.RaiseHwndMouseMove(args); }
private void dx_HwndMouseMove(object sender, HwndMouseEventArgs e) { if (is_left_captured) { float offset_x = (float)(e.Position.X - start_x) * 0.08f; float offset_y = (float)(e.Position.Y - start_y) * 0.06f; // Camera cam = scene.Camera; cam.Rotation.X = cycle(cam.Rotation.X - offset_x, -180f, 180f); cam.Rotation.Y = clamp(cam.Rotation.Y + offset_y, -88f, 88f); cam.UpdateWorldView(); } else if (is_right_captured) { float offset_x = (float)(e.Position.X - start_x) * 0.04f; float offset_y = (float)(e.Position.Y - start_y) * 0.04f; // Camera cam = scene.Camera; cam.MoveRel(-offset_x, 0f, -offset_y); cam.UpdateWorldView(); } }
private void xnaViewport_HwndMouseLeave(object sender, HwndMouseEventArgs e) { }
private void xnaViewport_HwndMButtonUp(object sender, HwndMouseEventArgs e) { _isMiddleMouseDown = false; xnaViewport.SetCursor(Cursors.Arrow); }
private void xnaViewport_HwndMButtonDown(object sender, HwndMouseEventArgs e) { _middleClickPoint = PointToVector2(e.Position); xnaViewport.SetCursor(Cursors.SizeAll); _isMiddleMouseDown = true; }
private void xnaViewport_HwndMouseWheel(object sender, HwndMouseEventArgs e) { Zoom(e.WheelDelta); }
protected override void RaiseHwndLButtonUp(HwndMouseEventArgs args) { HwndMouse.ShowCursor(); ReleaseMouseCapture(); base.RaiseHwndLButtonUp(args); }
/// <summary> /// We use the left mouse button to do exclusive capture of the mouse so we can drag and drag /// to rotate the cube without ever leaving the control /// </summary> /// <param name="args"></param> protected override void RaiseHwndLButtonDown(HwndMouseEventArgs args) { _originalPosition = HwndMouse.GetCursorPosition(); CaptureMouse(); HwndMouse.HideCursor(); base.RaiseHwndLButtonDown(args); }
private void dx_HwndRButtonUp(object sender, HwndMouseEventArgs e) { is_right_captured = false; dx.ReleaseMouseCapture(); }
private void OnHwndMouseEnter(object sender, HwndMouseEventArgs e) { _mouseEntered = true; }