Esempio n. 1
0
        /// <summary>
        /// Returns whether or not the given <see cref="InputMapping"/> is currently being activated.
        /// </summary>
        /// <param name="name">The name of the input mapping, that was saved within the current <see cref="InputProfile"/>, that should be tested.</param>
        /// <returns>Whether or not the <see cref="InputMapping"/> was just pressed.</returns>
        public bool Pressing(string name)
        {
            VerifyUpdateIsCalled();

            if (Profile == null)
            {
                throw new RelatusException("The input profile has not been set.");
            }

            InputMapping inputMapping = Profile.GetMapping(name);

            if (PlayerIndex == PlayerIndex.One)
            {
                if (KeyboardExt.Pressing(inputMapping.Keys) || MouseExt.Pressing(inputMapping.MouseButtons))
                {
                    return(true);
                }
            }

            if (gamePad.IsConnected)
            {
                if (gamePad.Pressing(inputMapping.GamepadButtons))
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns whether or not the given <see cref="InputMapping"/> is currently being activated.
        /// </summary>
        /// <param name="name">The name of the input mapping, that was saved within the current <see cref="InputProfile"/>, that should be tested.</param>
        /// <returns>Whether or not the <see cref="InputMapping"/> was just pressed.</returns>
        public bool Pressing(string name)
        {
            VerifyUpdateIsCalled();

            InputMapping inputMapping = inputProfile.GetMapping(name);

            if (PlayerIndex == PlayerIndex.One)
            {
                if (KeyboardExt.Pressing(inputMapping.Keys) || MouseExt.Pressing(inputMapping.MouseButtons))
                {
                    return(true);
                }
            }

            if (gamePad.IsConnected)
            {
                if (gamePad.Pressing(inputMapping.GamepadButtons))
                {
                    return(true);
                }
            }

            return(false);
        }