Exemple #1
0
 private void OnInput(OnInputEventArgs args)
 {
     foreach (EventHandler <OnInputEventArgs> eventHandler in _eventHandlers)
     {
         eventHandler.Invoke(this, args);
     }
 }
        public void Update(GameTime gameTime)
        {
            // SET _newInput to the current keyboard state using
            // Keyboard.GetState method
            _newInput = Keyboard.GetState();

            //if (_newInput.IsKeyDown(Keys.P))
            //{
            //    _pauseUnpause();
            //}

            // IF the _oldInput is not equal to the _newInput
            if (_oldInput != _newInput)
            {
                // SET _oldInput to the newInput
                _oldInput = _newInput;
                // DECLARE a new OnInputEventArgs called args
                // SET as new OnInputEventArgs passing in the input as a parameter
                OnInputEventArgs args = new OnInputEventArgs(_oldInput);
                // CALL to notifyListners method, passing in the args
                notifyListners(args);
            }
        }