mirror of
				https://github.com/Ryujinx/Opentk.git
				synced 2025-11-04 08:24:54 +00:00 
			
		
		
		
	[Input] Add GamePadCapabilities.IsMapped
This commit is contained in:
		
							parent
							
								
									742149412e
								
							
						
					
					
						commit
						71e5a4f4f3
					
				| 
						 | 
					@ -40,16 +40,18 @@ namespace OpenTK.Input
 | 
				
			||||||
        GamePadAxes axes;
 | 
					        GamePadAxes axes;
 | 
				
			||||||
        byte gamepad_type;
 | 
					        byte gamepad_type;
 | 
				
			||||||
        bool is_connected;
 | 
					        bool is_connected;
 | 
				
			||||||
 | 
					        bool is_mapped;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #region Constructors
 | 
					        #region Constructors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        internal GamePadCapabilities(GamePadType type, GamePadAxes axes, Buttons buttons, bool is_connected)
 | 
					        internal GamePadCapabilities(GamePadType type, GamePadAxes axes, Buttons buttons, bool is_connected, bool is_mapped)
 | 
				
			||||||
            : this()
 | 
					            : this()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            gamepad_type = (byte)type;
 | 
					            gamepad_type = (byte)type;
 | 
				
			||||||
            this.axes = axes;
 | 
					            this.axes = axes;
 | 
				
			||||||
            this.buttons = buttons;
 | 
					            this.buttons = buttons;
 | 
				
			||||||
            this.is_connected = is_connected;
 | 
					            this.is_connected = is_connected;
 | 
				
			||||||
 | 
					            this.is_mapped = is_mapped;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #endregion
 | 
					        #endregion
 | 
				
			||||||
| 
						 | 
					@ -317,6 +319,15 @@ namespace OpenTK.Input
 | 
				
			||||||
            get { return is_connected; }
 | 
					            get { return is_connected; }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        /// <summary>
 | 
				
			||||||
 | 
					        /// Gets a <see cref="System.Boolean"/> value describing whether a valid button configuration
 | 
				
			||||||
 | 
					        /// exists for this <c>GamePad</c> in the GamePad configuration database.
 | 
				
			||||||
 | 
					        /// </summary>
 | 
				
			||||||
 | 
					        public bool IsMapped
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get { return is_mapped; }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <param name="left">A <see cref="GamePadCapabilities"/> structure to test for equality.</param>
 | 
					        /// <param name="left">A <see cref="GamePadCapabilities"/> structure to test for equality.</param>
 | 
				
			||||||
        /// <param name="right">A <see cref="GamePadCapabilities"/> structure to test for equality.</param>
 | 
					        /// <param name="right">A <see cref="GamePadCapabilities"/> structure to test for equality.</param>
 | 
				
			||||||
        public static bool operator ==(GamePadCapabilities left, GamePadCapabilities right)
 | 
					        public static bool operator ==(GamePadCapabilities left, GamePadCapabilities right)
 | 
				
			||||||
| 
						 | 
					@ -338,11 +349,12 @@ namespace OpenTK.Input
 | 
				
			||||||
        public override string ToString()
 | 
					        public override string ToString()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return String.Format(
 | 
					            return String.Format(
 | 
				
			||||||
                "{{Type: {0}; Axes: {1}; Buttons: {2}; Connected: {3}}}",
 | 
					                "{{Type: {0}; Axes: {1}; Buttons: {2}; {3}; {4}}}",
 | 
				
			||||||
                GamePadType,
 | 
					                GamePadType,
 | 
				
			||||||
                Convert.ToString((int)axes, 2),
 | 
					                Convert.ToString((int)axes, 2),
 | 
				
			||||||
                Convert.ToString((int)buttons, 2),
 | 
					                Convert.ToString((int)buttons, 2),
 | 
				
			||||||
                IsConnected);
 | 
					                IsMapped ? "Mapped" : "Unmapped",
 | 
				
			||||||
 | 
					                IsConnected ? "Connected" : "Disconnected");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /// <summary>
 | 
					        /// <summary>
 | 
				
			||||||
| 
						 | 
					@ -355,6 +367,7 @@ namespace OpenTK.Input
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
                buttons.GetHashCode() ^
 | 
					                buttons.GetHashCode() ^
 | 
				
			||||||
                is_connected.GetHashCode() ^
 | 
					                is_connected.GetHashCode() ^
 | 
				
			||||||
 | 
					                is_mapped.GetHashCode() ^
 | 
				
			||||||
                gamepad_type.GetHashCode();
 | 
					                gamepad_type.GetHashCode();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -386,6 +399,7 @@ namespace OpenTK.Input
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
                buttons == other.buttons &&
 | 
					                buttons == other.buttons &&
 | 
				
			||||||
                is_connected == other.is_connected &&
 | 
					                is_connected == other.is_connected &&
 | 
				
			||||||
 | 
					                is_mapped == other.is_mapped &&
 | 
				
			||||||
                gamepad_type == other.gamepad_type;
 | 
					                gamepad_type == other.gamepad_type;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,8 @@ namespace OpenTK.Input
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    class GamePadConfigurationDatabase
 | 
					    class GamePadConfigurationDatabase
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        internal const string UnmappedName = "Unmapped Controller";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        readonly Dictionary<Guid, string> Configurations = new Dictionary<Guid, string>();
 | 
					        readonly Dictionary<Guid, string> Configurations = new Dictionary<Guid, string>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        internal GamePadConfigurationDatabase()
 | 
					        internal GamePadConfigurationDatabase()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -204,7 +204,8 @@ namespace OpenTK.Platform
 | 
				
			||||||
                    GamePadType.GamePad, // Todo: detect different types
 | 
					                    GamePadType.GamePad, // Todo: detect different types
 | 
				
			||||||
                    mapped_axes,
 | 
					                    mapped_axes,
 | 
				
			||||||
                    mapped_buttons,
 | 
					                    mapped_buttons,
 | 
				
			||||||
                    true);
 | 
					                    joy.IsConnected,
 | 
				
			||||||
 | 
					                    configuration.Name != GamePadConfigurationDatabase.UnmappedName);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue