private void OnMouseMoveEvent(SDL.SDL_MouseMotionEvent e) { var previousMousePosition = CurrentMousePosition; CurrentMousePosition = NormalizeScreenPosition(new Vector2(e.x, e.y)); // Discard this event if it has been triggered by the replacing the cursor to its capture initial position if (IsMousePositionLocked && Cursor.Position == _capturedPosition) { return; } CurrentMouseDelta += CurrentMousePosition - previousMousePosition; // trigger touch move events foreach (MouseButton button in Enum.GetValues(typeof(MouseButton))) { var buttonId = (int)button; if (MouseButtonCurrentlyDown[buttonId]) { HandlePointerEvents(buttonId, CurrentMousePosition, PointerState.Move, PointerType.Mouse); } } if (IsMousePositionLocked) { Cursor.Position = _capturedPosition; } }
private void OnMouseMoveEvent(SDL.SDL_MouseMotionEvent e) { var previousMousePosition = CurrentMousePosition; CurrentMousePosition = NormalizeScreenPosition(new Vector2(e.x, e.y)); // Discard this event if it has been triggered by the replacing the cursor to its capture initial position if (IsMousePositionLocked && (e.x == _relativeCapturedPosition.X && e.y == _relativeCapturedPosition.Y)) { return; } CurrentMouseDelta += CurrentMousePosition - previousMousePosition; // trigger touch move events foreach (MouseButton button in Enum.GetValues(typeof(MouseButton))) { var buttonId = (int)button; if (MouseButtonCurrentlyDown[buttonId]) { HandlePointerEvents(buttonId, CurrentMousePosition, PointerState.Move, PointerType.Mouse); } } if (IsMousePositionLocked) { // Restore position to prevent mouse from going out of the window where we would not get // mouse move event. UiControl.RelativeCursorPosition = _relativeCapturedPosition; } }
public static void HandleEvent(SDL.SDL_Event inputEvent) { _mouseMotionEvent = new SDL.SDL_MouseMotionEvent(); _mouseWheelDirection = 0; switch (inputEvent.type) { case SDL.SDL_EventType.SDL_KEYDOWN: _keysDown.Add(inputEvent.key.keysym.sym); break; case SDL.SDL_EventType.SDL_KEYUP: RemoveKey(inputEvent.key.keysym.sym); break; case SDL.SDL_EventType.SDL_MOUSEBUTTONDOWN: _mouseButtonsDown.Add(inputEvent.button.button); break; case SDL.SDL_EventType.SDL_MOUSEBUTTONUP: RemoveMouseButton(inputEvent.button.button); break; case SDL.SDL_EventType.SDL_MOUSEMOTION: _mouseMotionEvent = inputEvent.motion; break; case SDL.SDL_EventType.SDL_MOUSEWHEEL: _mouseWheelDirection = (int)inputEvent.wheel.direction; break; } }
private void OnMouseMoveEvent(SDL.SDL_MouseMotionEvent e) { if (IsPositionLocked) { MouseState.HandleMouseDelta(new Vector2(e.xrel, e.yrel)); } else { MouseState.HandleMove(new Vector2(e.x, e.y)); } }
private void OnMouseMoveEvent(SDL.SDL_MouseMotionEvent e) { if (IsPositionLocked) { MouseState.HandleMouseDelta(new Vector2(e.x - relativeCapturedPosition.X, e.y - relativeCapturedPosition.Y)); // Restore position to prevent mouse from going out of the window where we would not get // mouse move event. uiControl.RelativeCursorPosition = relativeCapturedPosition; } else { MouseState.HandleMove(new Vector2(e.x, e.y)); } }
/// <summary> /// Handle mouse move to handle hover cursor and text selection. /// </summary> /// <param name="parent">the control hosting the html to set cursor and invalidate</param> /// <param name="e">the mouse event args</param> public void HandleMouseMove(SDL.SDL_MouseMotionEvent e) { _htmlContainerInt.HandleMouseMove(new ControlAdapter(SDL2Adapter.Instance, e.ToRPoint()), e.ToRPoint()); }
public void ProcessMouseEvent(SDL.SDL_MouseMotionEvent motion) { state.X += motion.xrel; state.Y += motion.yrel; }
public static RPoint ToRPoint(this SDL.SDL_MouseMotionEvent e) { return(new RPoint(e.x, e.y)); }
public MouseMotionEventArgs(SDL.SDL_MouseMotionEvent evt) { _evt = evt; }