Ejemplo n.º 1
0
        public override void Update(DGameTime gameTime)
        {
            base.Update(gameTime);

            // get mouse stuff
            var leftMousePressed = Manager.InputManager.GetLeftMousePressed();
            var leftMouseReleased = Manager.InputManager.GetLeftMouseReleased();
            var mouseLocation = Manager.InputManager.GetMouseLocation();

            // check for dragging
            if (leftMousePressed && GetIsFocused() && Dragging == false)
            {
                System.Diagnostics.Debug.WriteLine("Start dragging.");
                Dragging = true;
                StartMouseLocation = mouseLocation;
            }

            if (Dragging)
            {
                System.Diagnostics.Debug.WriteLine("Dragging");
                CurrentMouseLocation = mouseLocation;
            }

            if (Dragging && leftMouseReleased)
            {
                System.Diagnostics.Debug.WriteLine("End dragging.");
                Dragging = false;
            }

            // check for configuration changes, if nothing changed , then return
            if (Config.Changed == false) return;
            Config.ResetChanged();
        }
        public override void Update(DGameTime gameTime)
        {
            base.Update(gameTime);

            // get mouse stuff
            var leftMousePressed  = Manager.InputManager.GetLeftMousePressed();
            var leftMouseReleased = Manager.InputManager.GetLeftMouseReleased();
            var mouseLocation     = Manager.InputManager.GetMouseLocation();

            // check for dragging
            if (leftMousePressed && GetIsFocused() && Dragging == false)
            {
                System.Diagnostics.Debug.WriteLine("Start dragging.");
                Dragging           = true;
                StartMouseLocation = mouseLocation;
            }

            if (Dragging)
            {
                System.Diagnostics.Debug.WriteLine("Dragging");
                CurrentMouseLocation = mouseLocation;
            }

            if (Dragging && leftMouseReleased)
            {
                System.Diagnostics.Debug.WriteLine("End dragging.");
                Dragging = false;
            }

            // check for configuration changes, if nothing changed , then return
            if (Config.Changed == false)
            {
                return;
            }
            Config.ResetChanged();
        }