Beispiel #1
0
 /// <summary>
 /// Connects the gamepad.
 /// </summary>
 /// <param name="gamepad">The gamepad.</param>
 private void EnsureGamepadInitialized(EliteGamepad gamepad)
 {
     lock (this.gamepadLock)
     {
         EliteGamepad.CheckForDriverLoaded();
         this.gamepad = gamepad;
         this.IsReady = true;
     }
 }
Beispiel #2
0
        /// <summary>
        /// Tries the create.
        /// </summary>
        /// <param name="gamepadFriendlyName">ID of the game pad trying to be created.</param>
        /// <param name="gamepad">The gamepad.</param>
        /// <returns>True if a gamepad was created successfully; otherwise, false.</returns>
        public static bool TryCreate(string gamepadFriendlyName, out EliteGamepadAdapter gamepad)
        {
            EliteGamepad.CheckForDriverLoaded();
            var underlying = EliteGamepad.EliteGamepads.FirstOrDefault(g => g.FriendlyName == gamepadFriendlyName);

            if (underlying == null)
            {
                gamepad = null;
                return(false);
            }

            gamepad = new EliteGamepadAdapter(underlying);
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// Tries to create a gamepad.
        /// </summary>
        /// <param name="gamepad">The gamepad.</param>
        /// <returns>True if a gamepad was created successfully; otherwise, false.</returns>
        public static bool TryCreate(out EliteGamepadAdapter gamepad)
        {
            EliteGamepad.CheckForDriverLoaded();
            var underlying = EliteGamepad.EliteGamepads.FirstOrDefault();

            if (underlying == null)
            {
                gamepad = null;
                return(false);
            }

            var config = underlying.GetConfiguration(underlying.CurrentSlotId);

            gamepad = new EliteGamepadAdapter(underlying);
            return(true);
        }