コード例 #1
0
 /// <summary>
 ///		Process a <see cref="Shared.Events.EngineActions.MouseScrollEvent"/>
 /// </summary>
 /// <param name="mouseScrollEvent"></param>
 public void ProcessMouseScrollEvent(MouseScrollEvent mouseScrollEvent)
 {
     MouseScrollEvent(new CefMouseEvent
     {
         X = mouseScrollEvent.MouseX,
         Y = mouseScrollEvent.MouseY
     }, mouseScrollEvent.MouseScroll);
 }
コード例 #2
0
ファイル: Dmouse.cs プロジェクト: Hengle/GameEngine
        /// <summary>
        /// If mouse has been scrolled, call listener functions
        /// </summary>
        /// <param name="state"></param>
        public virtual void OnNewScroll(int state)
        {
            MouseScrollEvent eve = new MouseScrollEvent(state);

            if (newMouseScroll != null)
            {
                newMouseScroll(this, eve);
            }
        }
コード例 #3
0
 /// <summary>
 ///     Return true if an mouse scroll event is in the array of expected events.
 ///     This method itslef defines the logic to determine if two mouse scroll events are equal.
 /// </summary>
 /// <param name="event">an event that is expected to be in the array of expected events</param>
 /// <param name="expectedEvents">an array of expected events</param>
 /// <returns>true if an event is indeed in the array of expected events.</returns>
 private bool IsMouseScrollEventFound(MouseScrollEvent @event, MouseScrollEvent[] expectedEvents)
 {
     foreach (MouseScrollEvent e in expectedEvents)
     {
         if (@event.ScrollAmount.Equals(e.ScrollAmount) && @event.MousePosition.Equals(e.MousePosition) && @event.HWnd.Equals(e.HWnd))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
        private void OnMouseScrolled(MouseScrollEvent e)
        {
            //Camera zoom controls
            if (!EnableZoomControls)
            {
                return;
            }

            ZoomLevel -= e.OffsetY * 0.25f;
            ZoomLevel  = Math.Clamp(ZoomLevel, 0.25f, 1000f);
            camera.SetProjection(-AspectRatio * ZoomLevel, AspectRatio * ZoomLevel, -ZoomLevel, ZoomLevel);
        }
コード例 #5
0
        private bool OnMouseScroll(MouseScrollEvent e)
        {
            AXProfiler.Capture(() =>
            {
                _zoomLevel -= e.Offset.Y * _zoomSpeed;
                _zoomLevel  = Math.Max(_zoomLevel, 0.25f);
                Camera.SetProjection(-_aspectRatio * _zoomLevel, _aspectRatio * _zoomLevel, -_zoomLevel,
                                     _zoomLevel);
            });

            return(false);
        }
コード例 #6
0
        public virtual void newMouseScroll(object source, MouseScrollEvent mouseData)
        {
            oldMouseScrollVal = mouseScrollVal;
            mouseScrollVal    = mouseData.mouseScroll / 100;

            if (mouseScrollVal > oldMouseScrollVal)
            {
                getSetZoom += 0.1f;
            }
            else if (mouseScrollVal < oldMouseScrollVal)
            {
                getSetZoom -= 0.1f;
            }
            ;
        }
コード例 #7
0
        public override bool Handle(IEvent evt)
        {
            if (CVars.Get <bool>("debug_force_debug_camera"))
            {
                MouseButtonEvent mouseButtonEvent = evt as MouseButtonEvent;
                if (mouseButtonEvent != null)
                {
                    if (mouseButtonEvent.LeftButtonState == ButtonState.Pressed)
                    {
                        _dragging = true;
                        _dragStartMousePosition = mouseButtonEvent.CurrentPosition;
                        _dragStartPosition      = Position;
                    }
                    else
                    {
                        _dragging = false;
                    }
                    return(true);
                }
                MouseMoveEvent mouseMoveEvent = evt as MouseMoveEvent;
                if (mouseMoveEvent != null)
                {
                    if (_dragging)
                    {
                        Vector2 pos = _dragStartPosition + (mouseMoveEvent.CurrentPosition - _dragStartMousePosition) * new Vector2(-1, 1);
                        CVars.Get <float>("debug_debug_camera_position_x") = pos.X;
                        CVars.Get <float>("debug_debug_camera_position_y") = pos.Y;
                        //CVars.Get<float>("debug_debug_camera_position_x") = mouseMoveEvent.CurrentPosition.X - _dragStartMousePosition.X;
                        //CVars.Get<float>("debug_debug_camera_position_y") = mouseMoveEvent.CurrentPosition.Y - _dragStartMousePosition.Y;
                        UpdateFromCVars();
                        return(true);
                    }
                }
                MouseScrollEvent mouseScrollEvent = evt as MouseScrollEvent;
                if (mouseScrollEvent != null)
                {
                    CVars.Get <float>("debug_debug_camera_zoom") += mouseScrollEvent.Delta * CVars.Get <float>("debug_debug_camera_zoom_speed");
                    CVars.Get <float>("debug_debug_camera_zoom")  = MathHelper.Max(0, CVars.Get <float>("debug_debug_camera_zoom"));
                    UpdateFromCVars();
                    return(true);
                }
            }

            return(base.Handle(evt));
        }
コード例 #8
0
 /// <summary>
 ///		Handel a <see cref="MouseScrollEvent"/>
 /// </summary>
 /// <param name="mouseScrollEvent"></param>
 public void HandelMouseScrollEvent(MouseScrollEvent mouseScrollEvent)
 {
     cefClient.ProcessMouseScrollEvent(mouseScrollEvent);
 }
コード例 #9
0
ファイル: AXWindow.Callback.cs プロジェクト: joffarex/AcidarX
        private void OnMouseScroll(IMouse mouse, ScrollWheel offset)
        {
            var mouseScrolledEvent = new MouseScrollEvent(new Vector2(offset.X, offset.Y));

            EventCallback(mouseScrolledEvent);
        }
コード例 #10
0
 private void OnMouseScrollEvent(Window window, MouseScrollEvent ev)
 {
     _mouseScrollEvents.Enqueue(ev);
 }