Ejemplo n.º 1
0
        /// <summary>
        /// Checks the Gamepad passed in and verifies if the command name has been inputted by the user.
        /// </summary>
        /// <param name="commandName">command name to check</param>
        /// <param name="buttonStates">the button combination identifying what buttons are pressed</param>
        /// <returns>true if the command is being activated by the GamePadButtons</returns>
        public static bool CheckCommand(string commandName, GamePadButtons buttonStates)
        {
            LastError = MappingError.NO_ERROR;

            if (!_controllerMap.Keys.Contains(commandName))
            {
                LastError |= MappingError.MAPPING_NOT_FOUND;
            }

            if (LastError != MappingError.NO_ERROR)
            {
                return false;
            }

            // this should return true if the buttons set in the controller map are the same as those in the buttonStates.
            return buttonStates.Equals(new GamePadButtons(_controllerMap[commandName]));
        }