Example #1
0
 private void OnButtonReleased(object sender, MonoGameMouseEventArgs args)
 {
     if (ButtonReleased != null)
     {
         ButtonReleased(sender, args);
     }
 }
Example #2
0
        internal MonoGameMouseEvents(int doubleClickMaxTimeDelta, int doubleClickMaxMovementDelta)
        {
            _doubleClickMaxTimeDelta     = doubleClickMaxTimeDelta;
            _doubleClickMaxMovementDelta = doubleClickMaxMovementDelta;

            _lastClick = new MonoGameMouseEventArgs(
                -1,
                -1,
                new TimeSpan(),
                Mouse.GetState(),
                Mouse.GetState());
        }
        internal MonoGameMouseEvents(int doubleClickMaxTimeDelta, int doubleClickMaxMovementDelta)
        {
            _doubleClickMaxTimeDelta = doubleClickMaxTimeDelta;
            _doubleClickMaxMovementDelta = doubleClickMaxMovementDelta;

            _lastClick = new MonoGameMouseEventArgs(
                -1, 
                -1,
                new TimeSpan(),
                Mouse.GetState(),
                Mouse.GetState());
        }
Example #4
0
        private void OnButtonPressed(object sender, MonoGameMouseEventArgs args)
        {
            // If this click is within the right time and position of the last click,
            // raise a double-click event as well.
            if (ButtonDoubleClicked != null &&
                _lastClick.Button == args.Button &&
                (args.Time - _lastClick.Time).TotalMilliseconds < _doubleClickMaxTimeDelta &&
                DistanceBetween(args.Current, _lastClick.Current) < _doubleClickMaxMovementDelta)
            {
                ButtonDoubleClicked(sender, args);
                //args.Time = new TimeSpan(0);
            }
            else if (ButtonPressed != null)
            {
                ButtonPressed(sender, args);
            }

            _lastClick = args;
        }
        private void OnButtonPressed(object sender, MonoGameMouseEventArgs args)
        {
            // If this click is within the right time and position of the last click, 
            // raise a double-click event as well.           
            if (ButtonDoubleClicked != null &&
                _lastClick.Button == args.Button &&
                (args.Time - _lastClick.Time).TotalMilliseconds < _doubleClickMaxTimeDelta &&
                DistanceBetween(args.Current, _lastClick.Current) < _doubleClickMaxMovementDelta)
            {
                ButtonDoubleClicked(sender, args);
                //args.Time = new TimeSpan(0);
            }
            else if (ButtonPressed != null) 
            {
                ButtonPressed(sender, args);
            }

            _lastClick = args;
        }   
 private void OnButtonReleased(object sender, MonoGameMouseEventArgs args)
 {
     if (ButtonReleased != null) 
     {
         ButtonReleased(sender, args);
     }
 }