Inheritance: MouseEventArgs
Exemplo n.º 1
0
 void Mouse_Move(object sender, MouseMoveEventArgs e)
 {
     if (Mouse[MouseButton.Left])
     {
         AddLine(e.X, e.Y);
     }
 }
Exemplo n.º 2
0
 public bool OnMouseMove(MouseMoveEventArgs e)
 {
     Point p = e.Position;
     if(this.hover != null) {
         if(this.hover.Bounds.Contains(p)) {
             this.hover.OnMouseMove(p-(Size) this.hover.Bounds.Location);
             return true;
         }
     }
     foreach(OpenGLComponent oglc in this.components) {
         if(oglc.Bounds.Contains(p)) {
             if(this.hover != null) {
                 this.hover.OnMouseLeave();
             }
             this.hover = oglc;
             this.hover.OnMouseEnter();
             return true;
         }
     }
     if(this.hover != null) {
         this.hover.OnMouseLeave();
     }
     this.hover = null;
     return false;
 }
Exemplo n.º 3
0
 void OnMouseMove(object sender, MouseMoveEventArgs e)
 {
     if (e.XDelta < 200 && e.YDelta < 200)
     {
         game.OnMouseMove(sender, e);
     }
 }
Exemplo n.º 4
0
        void mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs e)
        {
            Vector2 pos   = new Vector2(e.X, e.Y);
            Vector2 delta = new Vector2(e.XDelta, e.YDelta);

            root.OnMouseMoveEvent(new MouseMoveEventArgs(pos, delta));
        }
Exemplo n.º 5
0
        private void W_MouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
        {
            if (!e.Mouse.IsAnyButtonDown)
            {
                return;
            }


            yaw   -= e.XDelta * mouseSpeed;
            pitch += e.YDelta * mouseSpeed;

            pitch %= 360;
            yaw   %= 360;

            if (pitch > 89.0f)
            {
                pitch = 89.0f;
            }
            if (pitch < -89.0f)
            {
                pitch = -89.0f;
            }

            Vector3 front = new Vector3()
            {
                X = (float)Math.Cos(MathHelper.DegreesToRadians(pitch)) * (float)Math.Cos(MathHelper.DegreesToRadians(yaw)),
                Y = (float)Math.Sin(MathHelper.DegreesToRadians(pitch)),
                Z = (float)Math.Cos(MathHelper.DegreesToRadians(pitch)) * (float)Math.Sin(MathHelper.DegreesToRadians(yaw))
            };

            camFront = Vector3.Normalize(front);
        }
Exemplo n.º 6
0
 void Mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs e)
 {
     if (e.XDelta != 0 || e.YDelta != 0)
     {
         if (e.Mouse.MiddleButton == OpenTK.Input.ButtonState.Pressed)
         {
             if (Keyboard [OpenTK.Input.Key.ShiftLeft])
             {
                 Vector3 v = new Vector3(
                     Vector2.Normalize(vLook.Xy.PerpendicularLeft));
                 Vector3 tmp = Vector3.Transform(vLook,
                                                 Matrix4.CreateRotationZ(-e.XDelta * RotationSpeed) *
                                                 Matrix4.CreateFromAxisAngle(v, -e.YDelta * RotationSpeed));
                 tmp.Normalize();
                 if (tmp.Z <= 0f)
                 {
                     return;
                 }
                 vLook = tmp;
             }
             else
             {
                 Vector3 vH = new Vector3(Vector2.Normalize(vLook.Xy.PerpendicularLeft) * e.XDelta * MoveSpeed * eyeDist);
                 Vector3 vV = new Vector3(Vector2.Normalize(vLook.Xy) * e.YDelta * MoveSpeed * eyeDist);
                 vEyeTarget -= vH + vV;
             }
             UpdateViewMatrix();
             return;
         }
     }
 }
        private void OnMouseMove(object sender, MouseMoveEventArgs e)
        {
            if (e.Mouse.LeftButton == ButtonState.Pressed && _touches.Count > 0)
            {
                double now = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                float xConversion = SparrowSharpApp.Stage.Width / Size.Width;
                float yConversion = SparrowSharpApp.Stage.Height / Size.Height;

                Touch movedTouch = _touches[pointerId];
                movedTouch.PreviousGlobalX = movedTouch.GlobalX;
                movedTouch.PreviousGlobalY = movedTouch.GlobalY;
                movedTouch.TimeStamp = now;
                float xc = e.Mouse.X * xConversion;
                float yc = e.Mouse.Y * yConversion;
                if (movedTouch.GlobalX == xc && movedTouch.GlobalY == yc)
                {
                    movedTouch.Phase = TouchPhase.Stationary;
                }
                else
                {
                    movedTouch.GlobalX = xc;
                    movedTouch.GlobalY = yc;
                    movedTouch.Phase = TouchPhase.Moved;
                }
                if (movedTouch.Target == null || movedTouch.Target.Stage == null)
                {
                    // target could have been removed from stage -> find new target in that case
                    Point updatedTouchPosition = Point.Create(movedTouch.GlobalX, movedTouch.GlobalY);
                    movedTouch.Target = SparrowSharpApp.Root.HitTestPoint(updatedTouchPosition);
                }
            }
            processTouch();
        }
Exemplo n.º 8
0
		public static void ProcessMouse(int oriX,int oriY){
			
			EventArgs evnt=null;
			var pressed = false;
			prevMouseState =curMouseState;
			curMouseState = Mouse.GetCursorState ();
            Gwen.Input.InputHandler.HoveredControl =input.m_Canvas.GetControlAt(curMouseState.X - oriX, curMouseState.Y - oriY);
            foreach (var mouseCode in mouseCodes)
				if (curMouseState[mouseCode]!=prevMouseState[mouseCode]){
                    evnt = new MouseButtonEventArgs(curMouseState.X - oriX, curMouseState.Y - oriY, mouseCode, true);//last param bugged
                    //evnt = new MouseButtonEventArgs (curMouseState.X, curMouseState.Y, mouseCode,true);//last param bugged
					if (curMouseState [mouseCode]) {
						pressed = true;
                        Gwen.Input.InputHandler.MouseFocus = Gwen.Input.InputHandler.HoveredControl;
                        OnMouseDown?.Invoke ((MouseButtonEventArgs)evnt);
					} else {
						OnMouseUp?.Invoke ((MouseButtonEventArgs)evnt);

					}
				}
			Vector2 delta =MainWindow.lastPos - new Vector2(curMouseState.X, curMouseState.Y);
			if (Math.Abs (delta.X) > 0 || Math.Abs (delta.Y) > 0) {
				
				evnt = new MouseMoveEventArgs (curMouseState.X-oriX, curMouseState.Y-oriY,(int)delta.X,(int)delta.Y);
				OnMouseMove?.Invoke (evnt as MouseMoveEventArgs);
			}
			input.ProcessMouseMessage (evnt,pressed);
			MainWindow.lastPos = new Vector2 (curMouseState.X, curMouseState.Y);
		}
 protected override void MouseMove( object sender, MouseMoveEventArgs e )
 {
     base.MouseMove( sender, e );
     if( selectedWidget != null && selectedWidget == widgets[tableIndex] ) {
         LauncherTableWidget table = (LauncherTableWidget)widgets[tableIndex];
         table.MouseMove( e.XDelta, e.YDelta );
     }
 }
Exemplo n.º 10
0
		public override void OnMouseMove (MouseMoveEventArgs evnt)
		{
			//if (isDragging && Selection.assets.Count==0 && tree.SelectedChildren.Any ())
			//	foreach (var asset in tree.SelectedChildren)
			//		Selection.assets.Add (asset.Content);
			
			//canvas.NeedsRedraw = true;
		}
Exemplo n.º 11
0
 private void BoardGame_MouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
 {
     if (_boardRotate)
     {
         _camera.XRotate += e.XDelta;
         _camera.YRotate += e.YDelta;
     }
 }
Exemplo n.º 12
0
 private void GameWindow_MouseMove(object sender, MouseMoveEventArgs e)
 {
     if (ButtonState.Pressed == e.Mouse.LeftButton)
     {
         visual.OrbitCamera.Heading += 300 * e.XDelta / (float)gameWindow.Width;
         visual.OrbitCamera.Tilt += 300 * e.YDelta / (float)gameWindow.Height;
     }
 }
        protected virtual void mouseMoveHandler(object sender, MouseMoveEventArgs e)
        {
            if (this.mouseButtonDown) {

                // Console.WriteLine("mouse dragged: {0},{1}",e.XDelta,e.YDelta);
                this.scene.ActiveCamera.MouseDeltaOrient(e.XDelta,e.YDelta);
                // this.activeModel.MouseDeltaOrient(e.XDelta,e.YDelta);
            }
        }
Exemplo n.º 14
0
        public override void MouseMove(MouseMoveEventArgs e)
        {
            base.MouseMove(e);

            if (this.IsMouseOver() && !this.ShouldPassInput && !GUIManager.IsPanelAbovePoint(new Vector2(Utilities.engine.Mouse.X, Utilities.engine.Mouse.Y), this))
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Hand;
            }
        }
Exemplo n.º 15
0
        private void Window_MouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
        {
            var state = Mouse.GetState();

            if (state.IsButtonDown(MouseButton.Left))
            {
                viewpos += new Vector2(e.XDelta, -e.YDelta) * zoom * .003f;
                Console.WriteLine("viewpos: " + viewpos);
            }
        }
Exemplo n.º 16
0
            public static IEnumerable<GLMouseInput> FromArgs(MouseMoveEventArgs args, int windowWidth, int windowHeight)
            {
                int xDelta = args.X - windowWidth / 2;
                int yDelta = args.Y - windowHeight / 2;

                if (xDelta < 0) yield return new GLMouseInput(InputType.TurnLeft, InputState.Maintained, -xDelta);
                if (xDelta > 0) yield return new GLMouseInput(InputType.TurnRight, InputState.Maintained, xDelta);
                if (yDelta < 0) yield return new GLMouseInput(InputType.TurnUp, InputState.Maintained, -yDelta);
                if (yDelta > 0) yield return new GLMouseInput(InputType.TurnDown, InputState.Maintained, yDelta);
            }
Exemplo n.º 17
0
        void Mouse_Move(object sender, MouseMoveEventArgs e)
        {
			if (capture_mouse) {
                lock (_mouseDeltas)
                {
                    _mouseDeltas.y = e.YDelta * _mouse_speed;
                    _mouseDeltas.x = e.XDelta * _mouse_speed;
                }
            	//System.Windows.Forms.Cursor.Position = new System.Drawing.Point(500,500);
			}
        }
Exemplo n.º 18
0
 void Mouse_Move(object sender, MouseMoveEventArgs e)
 {
     CurrentMousePosition = new Vector2(e.X / ControlWidth, e.Y / ControlHeight);
     
     // 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);
     }
 }
Exemplo n.º 19
0
 protected override void OnMouseMove(MouseMoveEventArgs e)
 {
     switch (Settings.gameStatus)
     {
         case Settings.GameStatus.Startmenu:
             break;
         case Settings.GameStatus.Gamewindow:
             Game.OnMouseMove(e);
             break;
         default:
             break;
     }
 }
 void move(MouseMoveEventArgs e)
 {
     var dx = e.X - lastX;
     var dy = e.Y - lastY;
     lastX = e.X;
     lastY = e.Y;
     rx -= dx*xySpeed;
     ry -= dy*xySpeed;
     if(ry>=89)
         ry=89;
     if(ry<=-89)
         ry=-89;
 }
Exemplo n.º 21
0
 private void MouseKeyboard_MouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
 {
     if (!_workMode && e.Mouse.IsAnyButtonDown)
     {
         int pitch = Convert.ToInt16((_yOffset - e.Y));
         int roll  = Convert.ToInt16((e.X - _xOffset));
         if (_mouseButton == OpenTK.Input.MouseButton.Right)
         {
             OnPositionChanged(new OrientPosEventArgs(pitch, roll));
         }
         else if (_mouseButton == OpenTK.Input.MouseButton.Left)
         {
             OnOrientationChanged(new OrientPosEventArgs(pitch, roll));
         }
     }
 }
Exemplo n.º 22
0
        void OpenGLTess_MouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
        {
            if (!_enabled)
            {
                return;
            }

            if (_state == State.ROTATE && !_noRotate)
            {
                _rotateEnd = GetMouseProjectionOnBall(e.X, e.Y);
            }
            else if (_state == State.ZOOM && !_noZoom)
            {
                _zoomEnd = GetMouseOnScreen(e.X, e.Y);
            }
            else if (_state == State.PAN && !_noPan)
            {
                _panEnd = GetMouseOnScreen(e.X, e.Y);
            }
        }
Exemplo n.º 23
0
 protected override void OnMouseMove(OpenTK.Input.MouseMoveEventArgs e)
 {
     base.OnMouseMove(e);
     renderer.OnMouseMove((float)e.XDelta, (float)e.YDelta);
 }
Exemplo n.º 24
0
        // DOCU add
        internal virtual void OnMouseMoved(object sender, MouseMoveEventArgs e)
        {
            if (!Enabled || !Visible) return;											// component disabled or invisible

            EventHandler<MouseMoveEventArgs> handler;
            if (!Hovered && Contains (e.X, e.Y) && !IsOverlayedAt (e.X, e.Y)) { // && !Parent.IsOverlayedOn (e.X, e.Y)) {		UNDONE check parent overlaying?!
                Hovered = true;
                handler = MouseEnter;

                if (handler != null) handler (this, e);									// raise MouseEnter event
                #if DEBUG_UI
                Platform.Log.Write ("Event (type: MouseEnter, object: " + GetType ().Name + ", name: " + Name + ")", LogType.Debug);
                #endif
            } else if (Hovered && (!Contains (e.X, e.Y) || IsOverlayedAt (e.X, e.Y))) {
                Hovered = false;
                handler = MouseLeave;

                if (handler != null) handler (this, e);									// raise MouseLeave event
                #if DEBUG_UI
                Platform.Log.Write ("Event (type: MouseLeave, object: " + GetType ().Name + ", name: " + Name + ")", LogType.Debug);
                #endif
            }

            // UNDONE check mouse state; button pressed? wrong movement behaviour
            if (Active && Movable) Move (e.XDelta, e.YDelta);							// move component
        }
Exemplo n.º 25
0
 public void Mouse_Move(object sender, MouseMoveEventArgs e)
 {
     _mouseDelta = new Vector2(e.XDelta, e.YDelta);
 }
 void Mouse_Move(object sender, MouseMoveEventArgs args)
 {
     input.ProcessMouseMessage(args);
 }
Exemplo n.º 27
0
 private void OpenTKMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
 {
     OnMove(e.Position);
 }
Exemplo n.º 28
0
		public override void OnMouseMove (MouseMoveEventArgs evnt)
		{
			//Console.WriteLine ("locked? "+mouseLocked);
			if (mouseLocked) {
				if (selectedAxisId==0) {
					Camera.main.Rotate ((float)evnt.XDelta, (float)evnt.YDelta, 0.3f);//maybe divide delta by fov?
					SceneView.OnSetupMatrices?.Invoke ();

				}else{
					
					var constTValue = 1f;
					var constRValue = 1f;
					var constSValue = 1f;

					var deltaX = oldX - evnt.X;
					var deltaY = oldY - evnt.Y;
					if(evnt.XDelta!=0 && evnt.YDelta!=0)
					foreach (var selected in SceneStructureView.tree.SelectedChildren)
					{
						var entity = selected.Content as Entity;
							switch (selectedAxisId) {
							case 1:
								entity.Position += new Vector3 (-deltaX * constTValue,0,0);
								break;
							case 2:
								entity.Position += new Vector3 (0, deltaY * constTValue, 0);
								break;
							case 3:
								entity.Position += new Vector3 (0, 0, deltaX* constTValue);
								break;
							}
					}
				}
				MainWindow.focusedView=this;
				MainEditorView.canvas.NeedsRedraw = true;
			}
			oldX = evnt.X;
			oldY = evnt.Y;
		}
Exemplo n.º 29
0
 internal void HandleMouseMove(object sender, MouseMoveEventArgs e)
 {
     state = e.Mouse;
     Move(this, e);
 }
Exemplo n.º 30
0
 /// <summary>
 /// Constructs a new <see cref="MouseMoveEventArgs"/> instance.
 /// </summary>
 /// <param name="args">The <see cref="MouseMoveEventArgs"/> instance to clone.</param>
 public MouseMoveEventArgs(MouseMoveEventArgs args)
     : this(args.X, args.Y, args.XDelta, args.YDelta)
 {
 }
Exemplo n.º 31
0
 private void MouseMove(object sender, MouseMoveEventArgs e)
 {
     if (!_window.Focused) return;
     _currentX = e.X;
     _currentY = e.Y;
     _xDelta = e.XDelta;
     _yDelta = e.YDelta;
     if(Move != null)
         Move(sender, new DunamisMouseMoveEventArgs(e.X, e.Y, e.XDelta, e.YDelta));
 }
Exemplo n.º 32
0
 public void OnMouseMove(object sender, MouseMoveEventArgs args)
 {
     mouseDelta.X += args.XDelta;
     mouseDelta.Y += args.YDelta;
 }
Exemplo n.º 33
0
 void Mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs e)
 {
     game_engine.IN_MouseEvent(_MouseBtnState);
 }
Exemplo n.º 34
0
 /// <summary>
 /// Called when mouse is moving.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="mouseArgs">The <see cref="MouseMoveEventArgs"/> instance containing the event data.</param>
 protected void OnGameWinMouseMove(object sender, MouseMoveEventArgs mouseArgs)
 {
     if (MouseMove != null)
     {
         MouseMove(this, new MouseEventArgs
         {
             Button = MouseButtons.Unknown,
             Position = new Point { x = mouseArgs.X, y = mouseArgs.Y }
         });
     }
 }
Exemplo n.º 35
0
 /// <summary>
 /// Pohym myši po herním okně.
 /// </summary>
 /// <param name="e"></param>
 private void MouseMove(MouseMoveEventArgs e)
 {
     deltaX = e.XDelta;
     deltaY = e.YDelta;
 }
Exemplo n.º 36
0
 internal static void MouseMove(object sender, MouseMoveEventArgs mouse)
 {
     MousePos = new Vector2d(mouse.X, mouse.Y);
 }
Exemplo n.º 37
0
 void Mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs e)
 {
     Input.MouseEvent(_MouseBtnState);
 }
Exemplo n.º 38
0
        void Mouse_Move(object sender, OpenTK.Input.MouseMoveEventArgs e)
        {
            if (e.XDelta != 0 || e.YDelta != 0)
            {
                terrain.MouseMove(e);
                NotifyValueChanged("MousePos", MousePos);
                //selection texture has clientRect size and 4 bytes per pixel, so
                switch (CurrentState)
                {
                case GameState.Playing:
                    break;

                case GameState.RailTrackEdition:
                    TrackSegment ts = RailTrack.CurrentSegment;
                    if (ts != null)
                    {
                        if (terrain.SelCenterPos == ts.StartPos)
                        {
                            return;
                        }
                        if (e.Mouse.LeftButton == OpenTK.Input.ButtonState.Pressed)
                        {
                            ts.EndPos      = terrain.SelCenterPos;
                            ts.vStart      = Vector3.Normalize(ts.EndPos - ts.StartPos);
                            RailTrack.vEnd = ts.vStart;
                        }
                        else
                        {
                            ts.EndPos = terrain.SelCenterPos;
                            Vector3 vDir = Vector3.Normalize(ts.EndPos - ts.StartPos);
                            float   dot  = Vector3.Dot(ts.vStart, vDir);
                            RailTrack.vEnd = -(ts.vStart - 2 * dot * vDir);
                        }
                        RailTrack.UpdateTrackMesh();
                    }
                    break;
                }
                if (e.Mouse.MiddleButton == OpenTK.Input.ButtonState.Pressed)
                {
                    if (Keyboard [OpenTK.Input.Key.ShiftLeft])
                    {
                        Vector3 v = new Vector3(
                            Vector2.Normalize(vLook.Xy.PerpendicularLeft));
                        Vector3 tmp = Vector3.Transform(vLook,
                                                        Matrix4.CreateRotationZ(-e.XDelta * RotationSpeed) *
                                                        Matrix4.CreateFromAxisAngle(v, -e.YDelta * RotationSpeed));
                        tmp.Normalize();
                        if (tmp.Z <= 0f)
                        {
                            return;
                        }
                        vLook = tmp;
                    }
                    else
                    {
                        Vector3 vH = new Vector3(Vector2.Normalize(vLook.Xy.PerpendicularLeft) * e.XDelta * MoveSpeed * eyeDist);
                        Vector3 vV = new Vector3(Vector2.Normalize(vLook.Xy) * e.YDelta * MoveSpeed * eyeDist);
                        vEyeTarget -= vH + vV;
                    }
                    UpdateViewMatrix();
                }
            }
        }
Exemplo n.º 39
0
 void MouseMove( object sender, MouseMoveEventArgs e )
 {
     if( !game.GetActiveScreen.HandlesMouseMove( e.X, e.Y ) ) {
     }
 }
Exemplo n.º 40
0
        private void OnMouseMove( object sender, MouseMoveEventArgs e )
        {
            if ( myIgnoreMouse )
            {
                myIgnoreMouse = false;
                return;
            }

            if ( myCaptureMouse )
            {
                /*
                Vector2 rot = myGeoShader.CameraRotation;

                rot.Y += e.XDelta / 180.0f;
                rot.X += e.YDelta / 180.0f;
                rot.X = Tools.Clamp( rot.X, (float) -Math.PI / 2.0f, (float) Math.PI / 2.0f );

                myGeoShader.CameraRotation = rot;

                myIgnoreMouse = true;
                System.Windows.Forms.Cursor.Position = new System.Drawing.Point( Bounds.Left + Width / 2, Bounds.Top + Height / 2 );
                */
            }
            else
            {
                myUIRoot.SendMouseMoveEvent( new Vector2( Mouse.X, Mouse.Y ), e );
            }
        }
Exemplo n.º 41
0
 void MouseMoveHandler(object sender, MouseMoveEventArgs e)
 {
     refresh_text = true;
 }
Exemplo n.º 42
0
 private void MouseMove(object sender, MouseMoveEventArgs e)
 {
     Vector2 delta = new Vector2(e.XDelta / (float)Width, e.YDelta / (float)Height);
     if (mouseButtonLeftPressed)
     {
         navigation.MouseMoveUpdateView(delta);
     }
     if (mouseButtonRightPressed)
     {
         navigation.MouseMoveUpdateFocus(delta);
     }
 }
Exemplo n.º 43
0
 public void GameWindow_MouseMove(object sender, OpenTK.Input.MouseMoveEventArgs e)
 {
     mousePos     = new Vector2(e.X, e.Y);
     mouseDelta.X = e.XDelta;
     mouseDelta.Y = e.YDelta;
 }
Exemplo n.º 44
0
 protected void OnMouseMove(object sender, MouseMoveEventArgs e)
 {
     gwenInput.ProcessMouseMessage(e);
 }
Exemplo n.º 45
0
 /// <summary>
 /// Constructs a new <see cref="MouseMoveEventArgs"/> instance.
 /// </summary>
 /// <param name="args">The <see cref="MouseMoveEventArgs"/> instance to clone.</param>
 public MouseMoveEventArgs(MouseMoveEventArgs args)
     : this(args.X, args.Y, args.XDelta, args.YDelta)
 {
 }