Esempio n. 1
0
 /// <summary>
 /// Raises the ButtonUp event. This is automatically raised by an appropriately configured
 /// GamePadEvents object, but this allows for programmatic raising of events.
 /// </summary>
 public void OnButtonUp(object sender, GamePadButtonEventArgs args)
 {
     if (ButtonUp != null)
     {
         ButtonUp(sender, args);
     }
 }
Esempio n. 2
0
        private GamePadButtonEventArgs GetGamePadButtonEventArgs(TimeSpan time, PlayerIndex logicalIndex, Buttons buttons, GamePadState state)
        {
            GamePadButtonEventArgs _arg;

            if (_freeGPBEventArgs.Count == 0)
            { //If it doesn't exist
                _arg = new GamePadButtonEventArgs(time, logicalIndex, buttons, state);
                _allGPBEventArgs.Add(_arg);
                return(_arg);
            }

            //If it exists
            _arg = _freeGPBEventArgs[_freeGPBEventArgs.Count - 1];
            _freeGPBEventArgs.RemoveAt(_freeGPBEventArgs.Count - 1);

            _arg.Time         = time;
            _arg.Button       = buttons;
            _arg.LogicalIndex = logicalIndex;
            _arg.Current      = state;

            return(_arg);
        }