Inheritance: MouseEventArgs
Exemplo n.º 1
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);
		}
Exemplo n.º 2
0
        public void MouseUp(MouseButtonEventArgs args)
        {
            if (Interfaces.ContainsKey (lastState)) {

                Interfaces [lastState].MouseUp(args);
            }
        }
Exemplo n.º 3
0
 public void MouseButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (!Main.Focused)
     {
         return;
     }
 }
Exemplo n.º 4
0
 void Mouse_ButtonDown(object sender, MouseButtonEventArgs e)
 {
     for (Int16 i = 0; i < 6; i++)
     {
         if ((e.X > menuVects[i][0].X && e.X < menuVects[i][1].X) && ((Settings.Height - e.Y) > menuVects[i][0].Y && (Settings.Height - e.Y) < menuVects[i][2].Y))
         {
             switch (i)
             {
                 case 0: //Singleplayer clicked
                     ScreenManager.Push(new Screens.Singleplayer());
                     break;
                 case 1: //Multiplayer clicked
                     ScreenManager.Push(new Screens.Multiplayer());
                     break;
                 case 2: //Texture Packs clicked
                     break;
                 case 3: //Mods clicked
                     break;
                 case 4: //Options clicked
                     break;
                 case 5: //Exit clicked
                     Program.Close();
                     break;
             }
         }
     }
 }
Exemplo n.º 5
0
		private void OpenGLDisplay_MouseDown( object sender, MouseButtonEventArgs e )
		{
			_mouse_x = 0;
			_mouse_y = 0;
			System.Windows.Forms.Cursor.Position = new System.Drawing.Point( X + ( Width ) / 2, Y + Height / 2 );
			HiddenMouse = true;
		}
Exemplo n.º 6
0
        void mouse_ButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            MouseButton button   = (MouseButton)e.Button;
            Vector2     position = new Vector2(e.X, e.Y);

            root.OnMouseUpEvent(new MouseButtonEventArgs(button, position, GetModifierKeys()));
        }
Exemplo n.º 7
0
 private void _ButtonDown(object sender, MouseButtonEventArgs arguments)
 {
     if (!_window.Focused) return;
     _downButtons.Add((Button)arguments.Button);
     if(ButtonDown != null)
         ButtonDown(sender, new DunamisMouseButtonEventArgs((Button)arguments.Button));
 }
Exemplo n.º 8
0
 void Mouse_ButtonDown(object sender, MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Left)
     {
         AddLine(e.X, e.Y);
     }
 }
Exemplo n.º 9
0
        void Mouse_ButtonDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            if (e.Button == OpenTK.Input.MouseButton.Left)
            {
                switch (CurrentState)
                {
                case GameState.Playing:
                    break;

                case GameState.RailTrackEdition:
                    if (RailTrack.CurrentSegment == null)
                    {
                        RailTrack.CurrentSegment = new TrackSegment(terrain.SelCenterPos);
                        RailTrack.TrackStarts.Add(RailTrack.CurrentSegment);
                    }
                    else
                    {
                        TrackSegment newTS = new TrackSegment(RailTrack.CurrentSegment.EndPos, RailTrack.vEnd);
                        RailTrack.CurrentSegment.NextSegment.Add(newTS);
                        newTS.PreviousSegment.Add(RailTrack.CurrentSegment);
                        RailTrack.CurrentSegment = newTS;
                    }

                    RailTrack.UpdateTrackMesh();
                    break;
                }
            }
        }
Exemplo n.º 10
0
        public bool OnRaycastHitchanged(Input input, QbMatrix matrix, RaycastHit hit, ref Colort color, MouseButtonEventArgs e)
        {
            if ((e != null && e.IsPressed && e.Button == MouseButton.Left) || (e == null && input.mousedown(MouseButton.Left)))
            {
                QbMatrix mat = Singleton<QbManager>.INSTANCE.ActiveModel.matrices[hit.matrixIndex];
                if (mat != null)
                {
                    Voxel voxel;
                    if (mat.voxels.TryGetValue(mat.GetHash(hit.x, hit.y, hit.z), out voxel))
                    {
                        for (int i = 0; i < 10; i++)
                        {
                            var colorpal = Singleton<GUI>.INSTANCE.Get<EmptyWidget>(GUIID.START_COLOR_SELECTORS + i);

                            if ((bool)colorpal.customData["active"])
                            {
                                colorpal.appearence.Get<PlainBackground>("background").color = mat.colors[voxel.colorindex];
                                Singleton<GUI>.INSTANCE.Dirty = true;

                                Singleton<BrushManager>.INSTANCE.brushColor = mat.colors[voxel.colorindex];

                                Color4 colorr = mat.colors[voxel.colorindex];
                                Singleton<Broadcaster>.INSTANCE.Broadcast(Message.ColorSelectionChanged, colorpal, colorr);
                            }
                        }
                    }
                }
                return true;
            }
            return false;
        }
Exemplo n.º 11
0
 void Mouse_ButtonUp(object sender, MouseButtonEventArgs e)
 {
     md.X = e.X; md.Y = e.Y;
     md[e.Button] = false;
     md.Button = e.Button;
     app.MouseUp(sender, md);
 }
Exemplo n.º 12
0
 void Mouse_ButtonDown(object sender, MouseButtonEventArgs e)
 {
     md.X = e.X; md.Y = e.Y;
     md[e.Button] = true;
     md.Button = e.Button;
     app.MouseDown(sender, md);
 }
Exemplo n.º 13
0
 protected void OnMouseDownHandler(object sender, OpenTK.Input.MouseButtonEventArgs e)
 {   //Handles MouseDown Events
     if (e.IsPressed && (currentX != e.X && currentY != e.Y))
     {
         UpdateMouse(e.X, e.Y);
     }
 }
Exemplo n.º 14
0
 public override void OnClick(OpenTK.Input.MouseButtonEventArgs e)
 {
     if (IsToggleButton)
     {
         Checked = !Checked;
     }
     base.OnClick(e);
 }
Exemplo n.º 15
0
 public override void OnClick(OpenTK.Input.MouseButtonEventArgs e)
 {
     base.OnClick(e);
     if (Parent as ToolBarBase != null)
     {
         (Parent as ToolBarBase).OnButtonClick(this);
     }
 }
Exemplo n.º 16
0
        public void GameWindow_MouseDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            mouseClicked    = true;
            mouseClickedPos = new Vector2(e.X, e.Y);
            Vector2 glPos = ScreenPositionToGLViewport(e.X, e.Y);

            ui.Click(glPos.X, glPos.Y);
        }
Exemplo n.º 17
0
        private void Mouse_ButtonDown(object sender, MouseButtonEventArgs ea)
        {
            isDragging = true;
            mousePos = MousePos;
            if (mousePos.ModulusSquared > 0.98)
                isDraggingAngle = true;

            initialMousePos = mousePos;
        }
Exemplo n.º 18
0
 void MouseButtonUp(object s, OpenTK.Input.MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Right)
     {
         this.mouseDown = false;
         lastx          = 0;
         lasty          = 0;
     }
 }
Exemplo n.º 19
0
		void onDown (object sender, MouseButtonEventArgs e)
		{
			decimal tmp = 0;
			if (!decimal.TryParse (l.Text, out tmp))
				return;

			tmp -= 1;
			l.Text = tmp.ToString ();
		}
Exemplo n.º 20
0
        public override void MouseDown(MouseButtonEventArgs e)
        {
            base.MouseDown(e);

            if (this.IsMouseOver())
            {
                SetChecked(!this.IsChecked);
            }
        }
Exemplo n.º 21
0
 protected override void OnMouseDown(MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Right)
     {
         _move = e.IsPressed;
         _moveFocusX = e.X;
         _moveFocusY = e.Y;
     }
     base.OnMouseDown(e);
 }
Exemplo n.º 22
0
        void Mouse_ButtonDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            Game Window1 = new Game(1280, 729, null, "Window1", GameWindowFlags.FixedWindow);

            double fps = 60;

            Window1.VSync = VSyncMode.Adaptive;

            Window1.Run(fps, fps);
        }
Exemplo n.º 23
0
        protected override void OnMouseUp(OpenTK.Input.MouseButtonEventArgs e)
        {
            base.OnMouseUp(e);

            if (screen)
            {
                Vector2 p = new Vector2(e.Mouse.X, e.Mouse.Y);
                screen.HandleMouseButtonEvent(p, 0, e.IsPressed, 0);
            }
        }
Exemplo n.º 24
0
        void mouse_ButtonDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            MouseButton button   = (MouseButton)e.Button;
            Vector2     position = new Vector2(e.X, e.Y);

            if (root.Bounds.ContainsPoint(position))
            {
                root.OnMouseDownEvent(new MouseButtonEventArgs(button, position, GetModifierKeys()));
            }
        }
Exemplo n.º 25
0
 protected override void OnMouseUp(MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Right)
     {
         _move = e.IsPressed;
         Rescale();
         CalcData();
     }
     base.OnMouseUp(e);
 }
Exemplo n.º 26
0
 protected override void OnMouseUp(MouseButtonEventArgs e)
 {
   var button = ControllerMouseButton.Left;
   if (e.Button == MouseButton.Left)
     button = ControllerMouseButton.Left;
   else if (e.Button == MouseButton.Middle)
     button = ControllerMouseButton.Middle;
   else if (e.Button == MouseButton.Right)
     button = ControllerMouseButton.Right;
   _controller.MouseUp(button, e.X, e.Y);
 }
Exemplo n.º 27
0
 private void Mouse_ButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs mbe)
 {
     if (mbe.Button == OpenTK.Input.MouseButton.Left)
     {
         Game.leftButton = false;
     }
     else if (mbe.Button == OpenTK.Input.MouseButton.Right)
     {
         Game.rightButton = false;
     }
 }
Exemplo n.º 28
0
        protected override void OnMouseDown(OpenTK.Input.MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            Vector2 p = new Vector2(e.Mouse.X, e.Mouse.Y);

            if (screen && screen.ContainsPoint(p))
            {
                screen.HandleMouseButtonEvent(p, (int)e.Button, e.IsPressed, 0);
            }
        }
Exemplo n.º 29
0
        void OpenGLTess_MouseUp(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            if (!_enabled)
            {
                return;
            }



            _state = State.NONE;
        }
Exemplo n.º 30
0
 public override void OnClick(OpenTK.Input.MouseButtonEventArgs e)
 {
     if (Parent != null && Parent.Parent != null)
     {
         TabContainer tc = Parent.Parent as TabContainer;
         if (tc != null)
         {
             tc.SelectedTab = this.TabPage;
         }
     }
     base.OnClick(e);
 }
Exemplo n.º 31
0
        void Mouse_ButtonDown(object sender, MouseButtonEventArgs e)
        {
            var button = ConvertMouseButtonFromOpenTK(e.Button);
            var buttonId = (int)button;

            CurrentMousePosition = new Vector2(e.X / ControlWidth, e.Y / ControlHeight);
            var mouseInputEvent = new MouseInputEvent { Type = InputEventType.Down, MouseButton = button };
            lock (MouseInputEvents)
                MouseInputEvents.Add(mouseInputEvent);

            MouseButtonCurrentlyDown[buttonId] = true;
            HandlePointerEvents(buttonId, CurrentMousePosition, PointerState.Down, PointerType.Mouse);
        }
Exemplo n.º 32
0
 public void OnMouseUp(OpenTK.Input.MouseButtonEventArgs e)
 {
     if (e.Button == MouseButton.Left)
     {
         if (_selectedCollider != null)
         {
             _selectedCollider.Grabbed = false;
             if (_selectedCollider.IsTrigger)
             {
             }
             _selectedCollider = null;
         }
     }
 }
Exemplo n.º 33
0
        public override void OnMouseDown(OpenTK.Input.MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);

            SetActiveIcon(e.X, e.Y);
            if (ActiveItem != null)
            {
                ShowSubMenu(ActiveItem);
            }
            else
            {
                Invalidate();
            }
        }
Exemplo n.º 34
0
 public void Click(object sender, MouseButtonEventArgs e)
 {
     if (HandleRectangle.Contains(e.Position))
     {
         if (DynamicGrip)
         {
             Grip = new Point(e.Position.X - HandleRectangle.X, e.Position.Y - HandleRectangle.Y);
         }
         else
         {
             Grip = new Point(HandleRectangle.Width / 2, HandleRectangle.Height / 2);
         }
     }
 }
Exemplo n.º 35
0
 public override void MouseDown(OpenTK.Input.MouseButtonEventArgs e)
 {
     if (Status != WidgetStatus.Disabled)
     {
         if (e.Button == OpenTK.Input.MouseButton.Right && OnRightClick.Res != null)
         {
             OnRightClick.Res.Execute(this.GameObj, RightClickArgument);
         }
         if (e.Button == OpenTK.Input.MouseButton.Left && OnLeftClick.Res != null)
         {
             Status = WidgetStatus.Active;
             OnLeftClick.Res.Execute(this.GameObj, _leftClickArgument);
         }
     }
 }
Exemplo n.º 36
0
		public bool OnMouseDown(object sender, MouseButtonEventArgs e)
		{
            if (focusedControl != null && focusedControl.OnMouseDown(sender, e)) return true;

            for (int i = 0; i < windows.Length; i++)
            {
                if (windows[i].OnMouseDown(sender, e))
                {
                    SetTopMostWindow(windows[i]);
                    return true;
                }
            }

            focusedControl = null;
            return false;
		}
Exemplo n.º 37
0
        void Mouse_ButtonUp(object sender, MouseButtonEventArgs e)
        {
            var button = ConvertMouseButtonFromOpenTK(e.Button);
            var buttonId = (int)button;

            // the mouse events series has been interrupted because out of the window.
            if (!MouseButtonCurrentlyDown[buttonId])
                return;
            
            CurrentMousePosition = new Vector2(e.X / ControlWidth, e.Y / ControlHeight);
            var mouseInputEvent = new MouseInputEvent { Type = InputEventType.Up, MouseButton = button };
            lock (MouseInputEvents)
                MouseInputEvents.Add(mouseInputEvent);

            MouseButtonCurrentlyDown[buttonId] = false;
            HandlePointerEvents(buttonId, CurrentMousePosition, PointerState.Up, PointerType.Mouse);
        }
Exemplo n.º 38
0
		private void MouseButtonDownInternal(object _sender, MouseButtonEventArgs _e)
		{
			EMouseButton btn = EMouseButton.LEFT;
			switch (_e.Button)
			{
				case MouseButton.Left:
					btn = EMouseButton.LEFT;
					break;
				case MouseButton.Middle:
					btn = EMouseButton.MIDDLE;
					break;
				case MouseButton.Right:
					btn = EMouseButton.RIGHT;
					break;
			}
			MouseButtonDown(new Point(_e.X / Constants.TILE_SIZE, _e.Y / Constants.TILE_SIZE), btn);
		}
Exemplo n.º 39
0
 protected void MouseClick(object s, OpenTK.Input.MouseButtonEventArgs e)
 {
     if (e.Button == OpenTK.Input.MouseButton.Left)
     {
         mouseLock = !mouseLock;
         if (mouseLock)
         {
             System.Windows.Forms.Cursor.Hide();
             System.Windows.Forms.Cursor.Position =
                 new Point(Bounds.Left + (Bounds.Width / 2), Bounds.Top + (Bounds.Height / 2));
         }
         else
         {
             System.Windows.Forms.Cursor.Show();
         }
     }
 }
Exemplo n.º 40
0
        public bool OnRaycastHitchanged(Input input, QbMatrix matrix, RaycastHit hit, ref Colort color, MouseButtonEventArgs e)
        {
            lastmatrix = matrix;
            switch (state)
            {
                case ToolState.Start:
                    if ((e != null && e.IsPressed && e.Button == MouseButton.Left) || (e == null && input.mousedown(MouseButton.Left)))
                    {
                        state = ToolState.Base;
                        Singleton<Raycaster>.INSTANCE.testdirt = true;
                        startPosition = new VoxelLocation(hit, false);
                        endPosition = new VoxelLocation(hit, false);
                        volume = new VoxelVolume(startPosition, endPosition);
                        modifiedVoxels.Clear();
                        EnumerateVolume(volume, lastvolume, matrix, ref color, modifiedVoxels);
                        lastvolume = volume;
                        return true;
                    }
                    break;
                case ToolState.Base:
                    if ((e != null && e.IsPressed && e.Button == MouseButton.Left) || (e == null && input.mousedown(MouseButton.Left)))
                    {
                        endPosition = new VoxelLocation(hit, false);
                        volume = new VoxelVolume(startPosition, endPosition);

                        EnumerateVolume(volume, lastvolume, matrix, ref color, modifiedVoxels);
                        CleanLastVolume(lastvolume, volume, matrix, modifiedVoxels);
                        lastvolume = volume;

                        return true;
                    }
                    else if ((e != null && !e.IsPressed && e.Button == MouseButton.Left) || (e == null && input.mouseup(MouseButton.Left)))

                    {
                        state = ToolState.Start;
                        lastvolume = VoxelVolume.NEGATIVE_ZERO;
                        Singleton<UndoRedo>.INSTANCE.AddUndo(BrushType, matrix, volume, color, modifiedVoxels);
                        return true;
                    }
                    break;
                case ToolState.Limit:
                    break;
            }
            return false;
        }
Exemplo n.º 41
0
 public override void OnMouseDown(OpenTK.Input.MouseButtonEventArgs e)
 {
     IsMouseDown = true;
     base.OnMouseDown(e);
     Invalidate();
     if (IsAutofire)
     {
         if (Enabled && WidgetState == WidgetStates.Pressed)
         {
             try {
                 OnFire();
                 Timer.Start();
             } catch (Exception ex) {
                 ex.LogWarning();
             }
         }
     }
 }
Exemplo n.º 42
0
        public void processMouseDown(OpenTK.Input.MouseButtonEventArgs e)
        {
            if (CardInstance.selectedCard == null)
            {
                return;
            }

            switch (e.Button)
            {
            case OpenTK.Input.MouseButton.Left:
                ClickOnCard(CardInstance.selectedCard);
                break;

            case OpenTK.Input.MouseButton.Right:
                CardInstance.selectedCard.SwitchFocus();
                break;
            }
        }
Exemplo n.º 43
0
        protected override void OnMouseDown(OpenTK.Input.MouseButtonEventArgs e)
        {
            var mouseX = e.Position.X - 300;
            var mouseY = 300 - e.Position.Y;

            if (this.criandoObjeto && !this.criandoFilho)
            {
                this.criarObjeto(mouseX, mouseY);
            }
            else if (this.criandoFilho)
            {
                this.criarFilho(mouseX, mouseY);
            }
            else
            {
                this.selecionarObjeto(mouseX, mouseY);
            }
        }
        protected virtual void mouseDownHandler(object sender, MouseButtonEventArgs e)
        {
            if (!base.Focused) return;

            this.mouseButtonDown = true;

            // cast ray for mouse click
            var clientRect = new System.Drawing.Size(ClientRectangle.Width, ClientRectangle.Height);
            Vector2 mouseLoc = new Vector2(e.X,e.Y);

            SSRay ray = OpenTKHelper.MouseToWorldRay(
                this.scene.renderConfig.projectionMatrix, this.scene.renderConfig.invCameraViewMatrix, clientRect, mouseLoc);

            // Console.WriteLine("mouse ({0},{1}) unproject to ray ({2})",e.X,e.Y,ray);
            // scene.addObject(new SSObjectRay(ray));

            selectedObject = scene.Intersect(ref ray);
            updateWireframeDisplayText ();
        }
Exemplo n.º 45
0
 protected override void OnMouseDown(MouseButtonEventArgs e)
 {
     switch (Settings.gameStatus)
     {
         case Settings.GameStatus.Startmenu:
             Menu.OnMouseDown(e);
             break;
         case Settings.GameStatus.Gamewindow:
             break;
         case Settings.GameStatus.Optionsmenu:
             Menu.OnMouseDown(e);
             break;
         case Settings.GameStatus.Highscoresmenu:
             Menu.OnMouseDown(e);
             break;
         default:
             break;
     }
 }
Exemplo n.º 46
0
        void Mouse_ButtonEvent(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            _MouseBtnState = 0;

            if (e.Button == MouseButton.Left && e.IsPressed)
            {
                _MouseBtnState |= 1;
            }

            if (e.Button == MouseButton.Right && e.IsPressed)
            {
                _MouseBtnState |= 2;
            }

            if (e.Button == MouseButton.Middle && e.IsPressed)
            {
                _MouseBtnState |= 4;
            }

            Input.MouseEvent(_MouseBtnState);
        }
Exemplo n.º 47
0
        private void GameWindow_MouseDown(object sender, MouseButtonEventArgs e)
        {
            //transform window coordinates to grid coordinates
            var gridX = (e.X * gameState.GridWidth) / (gameWindow.Width - 1);
            var gridY = (e.Y * gameState.GridHeight) / (gameWindow.Height - 1);

            FieldType field;
            switch (e.Button)
            {
                case MouseButton.Left:
                    field = FieldType.CROSS;
                    break;
                case MouseButton.Right:
                    field = FieldType.DIAMONT;
                    break;
                default:
                    field = FieldType.EMPTY;
                    break;
            }
            gameState[gridX, gridY] = field;
        }
        // TODO unify this with Android code
        private void OnMouseButtonChange(object sender, MouseButtonEventArgs e)
        {
            double now = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
            float xConversion = SparrowSharpApp.Stage.Width / Size.Width;
            float yConversion = SparrowSharpApp.Stage.Height / Size.Height;
            Touch touchInFocus;

            if (e.Mouse.LeftButton == ButtonState.Pressed)
            {
                Touch newTouch = new Touch();
                newTouch.TouchID = pointerId;
                newTouch.TimeStamp = now;
                newTouch.GlobalX = e.Mouse.X * xConversion;
                newTouch.GlobalY = e.Mouse.Y * yConversion;
                newTouch.InitialGlobalX = newTouch.GlobalX;
                newTouch.InitialGlobalY = newTouch.GlobalY;
                newTouch.Phase = TouchPhase.Began;
                Point touchPosition = Point.Create(newTouch.GlobalX, newTouch.GlobalY);
                newTouch.Target = SparrowSharpApp.Stage.HitTestPoint(touchPosition);

                _touches.Add(newTouch.TouchID, newTouch);
            }
            else
            {
                touchInFocus = _touches[pointerId];
                touchInFocus.Phase = TouchPhase.Ended;
                long downTime = -1; // TODO
                touchInFocus.TimeStamp = now;
                double dist = Math.Sqrt(
                                  (touchInFocus.GlobalX - touchInFocus.InitialGlobalX) * (touchInFocus.GlobalX - touchInFocus.InitialGlobalX) +
                                  (touchInFocus.GlobalY - touchInFocus.InitialGlobalY) * (touchInFocus.GlobalY - touchInFocus.InitialGlobalY));
                // TODO: move the time out to a constant, make dist DPI dependent
                if (downTime < 300 && dist < 50)
                {
                    touchInFocus.IsTap = true;
                }
            }
            processTouch();
        }
Exemplo n.º 49
0
        private void OpenTKButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            MouseButton button;

            if (e.Button == OpenTK.Input.MouseButton.Left)
            {
                button = MouseButton.Left;
            }
            else if (e.Button == OpenTK.Input.MouseButton.Middle)
            {
                button = MouseButton.Middle;
            }
            else if (e.Button == OpenTK.Input.MouseButton.Right)
            {
                button = MouseButton.Right;
            }
            else
            {
                return;
            }

            OnButtonUp(e.Position, button);
        }
Exemplo n.º 50
0
        void OpenGLTess_MouseDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
        {
            if (!_enabled)
            {
                return;
            }


            if (_state == State.NONE)
            {
                if (OpenTK.Input.Mouse.GetState()[MouseButton.Right])
                {
                    _state = State.PAN;
                }
                else
                {
                    _state = State.ROTATE;
                }
                //   _state = e.Button;//  event.button;
            }

            if (_state == State.ROTATE && !_noRotate)
            {
                _rotateStart = GetMouseProjectionOnBall(e.X, e.Y);
                _rotateEnd   = _rotateStart;
            }
            else if (_state == State.ZOOM && !_noZoom)
            {
                _zoomStart = GetMouseOnScreen(e.X, e.Y);
                _zoomEnd   = _zoomStart;
            }
            else if (_state == State.PAN && !_noPan)
            {
                _panStart = GetMouseOnScreen(e.X, e.Y);
                _panEnd   = _panStart;
            }
        }
Exemplo n.º 51
0
        public bool OnRaycastHitchanged(Input input, QbMatrix matrix, RaycastHit hit, ref Colort color, MouseButtonEventArgs e)
        {
            if (matrix == null)
            {
                if (lastmatrix != null)
                {
                    lastmatrix.highlight = Color4.White;
                    lastmatrix = null;
                    Singleton<GUI>.INSTANCE.Get<Label>(GUIID.STATUS_TEXT).text = "";
                }
                return true;
            }

            if(matrix != lastmatrix)
            {
                if (lastmatrix != null)
                    lastmatrix.highlight = Color4.White;
                matrix.highlight = new Colort(1.5f, 1.5f, 1.5f);

                lastmatrix = matrix;
                Singleton<GUI>.INSTANCE.Get<Label>(GUIID.STATUS_TEXT).text = $"Over Matrix : {matrix.name}";
            }
            return true;
        }
Exemplo n.º 52
0
 void Mouse_ButtonUp(object sender, OpenTK.Input.MouseButtonEventArgs e)
 {
 }
Exemplo n.º 53
0
 private void MouseKeyboard_MouseDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
 {
     _xOffset     = e.X;
     _yOffset     = e.Y;
     _mouseButton = e.Button;
 }
Exemplo n.º 54
0
        protected void OnMouseButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (!Focused)
                return;

            gwenInput.ProcessMouseMessage(e);
        }
Exemplo n.º 55
0
 public void GameWindow_MouseUp(object sender, OpenTK.Input.MouseButtonEventArgs e)
 {
     mouseClicked = false;
 }
Exemplo n.º 56
0
        /// <summary>
        /// Called when mouse button is released.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="mouseArgs">The <see cref="MouseButtonEventArgs"/> instance containing the event data.</param>
        protected void OnGameWinMouseUp(object sender, MouseButtonEventArgs mouseArgs)
        {
            if (MouseButtonUp != null)
            {
                var mb = MouseButtons.Unknown;

                switch (mouseArgs.Button)
                {
                    case MouseButton.Left:
                        mb = MouseButtons.Left;
                        break;
                    case MouseButton.Middle:
                        mb = MouseButtons.Middle;
                        break;
                    case MouseButton.Right:
                        mb = MouseButtons.Right;
                        break;
                }

                MouseButtonUp(this, new MouseEventArgs
                    {
                        Button = mb,
                        Position = new Point {x = mouseArgs.X, y = mouseArgs.Y}
                    });
            }
        }
Exemplo n.º 57
0
 public void GameWindow_MouseDown(object sender, OpenTK.Input.MouseButtonEventArgs e)
 {
     mouseButtonDown = true;
 }
Exemplo n.º 58
0
 public void OnMouseDown(MouseButtonEventArgs e)
 {
     
 }
Exemplo n.º 59
0
 private void MouseKeyboard_MouseUp(object sender, OpenTK.Input.MouseButtonEventArgs e)
 {
     OnChangeOrientPosZoomOperationCompleted(new EventArgs());
 }