Exemplo n.º 1
0
			public void UpdateFromSource(IJoystickInputSource source)
			{
				if (source == null) return;
				for (int i = 0; i < this.ButtonPressed.Length; i++)
				{
					this.ButtonPressed[i] = source[(JoystickButton)i];
				}
				for (int i = 0; i < this.AxisValue.Length; i++)
				{
					this.AxisValue[i] = source[(JoystickAxis)i];
				}
			}
Exemplo n.º 2
0
 /// <summary>
 /// Removes a previously registered extended user input source.
 /// Note that the <see cref="JoystickInput"/> will still exist,
 /// but become <see cref="JoystickInput.IsAvailable">unavailable</see> until
 /// a new matching input source is registered.
 /// </summary>
 /// <param name="source"></param>
 /// <returns>Returns true, if the source was successfully removed.</returns>
 public bool RemoveSource(IJoystickInputSource source)
 {
     foreach (JoystickInput registeredInput in this.input)
     {
         if (registeredInput.Source == source)
         {
             registeredInput.Source = null;
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 3
0
 public void UpdateFromSource(IJoystickInputSource source)
 {
     if (source == null)
     {
         return;
     }
     for (int i = 0; i < this.ButtonPressed.Length; i++)
     {
         this.ButtonPressed[i] = source[(JoystickButton)i];
     }
     for (int i = 0; i < this.AxisValue.Length; i++)
     {
         this.AxisValue[i] = source[(JoystickAxis)i];
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Adds a new extended user input source.
        /// </summary>
        /// <param name="source"></param>
        public void AddSource(IJoystickInputSource source)
        {
            foreach (JoystickInput registeredInput in input)
            {
                if (registeredInput.Description == source.Description &&
                    registeredInput.Source == null)
                {
                    registeredInput.Source = source;
                    return;
                }
            }

            JoystickInput newInput = new JoystickInput();

            newInput.Source = source;
            input.Add(newInput);
        }
Exemplo n.º 5
0
			public void UpdateFromSource(IJoystickInputSource source)
			{
				this.IsAvailable = source != null ? source.IsAvailable : false;
				if (source == null) return;

				for (int i = 0; i < this.ButtonPressed.Length; i++)
				{
					this.ButtonPressed[i] = source[(JoystickButton)i];
				}
				for (int i = 0; i < this.AxisValue.Length; i++)
				{
					this.AxisValue[i] = source[(JoystickAxis)i];
				}
				for (int i = 0; i < this.HatPosition.Length; i++)
				{
					this.HatPosition[i] = source[(JoystickHat)i];
				}
			}
Exemplo n.º 6
0
            public void UpdateFromSource(IJoystickInputSource source)
            {
                this.IsAvailable = source != null ? source.IsAvailable : false;
                if (source == null)
                {
                    return;
                }

                for (int i = 0; i < this.ButtonPressed.Length; i++)
                {
                    this.ButtonPressed[i] = source[(JoystickButton)i];
                }
                for (int i = 0; i < this.AxisValue.Length; i++)
                {
                    this.AxisValue[i] = source[(JoystickAxis)i];
                }
                for (int i = 0; i < this.HatPosition.Length; i++)
                {
                    this.HatPosition[i] = source[(JoystickHat)i];
                }
            }
Exemplo n.º 7
0
	    /// <summary>
	    /// Adds an extended user input source.
	    /// </summary>
	    /// <param name="source"></param>
	    public static void AddInputSource(IJoystickInputSource source)
	    {
	        foreach (JoystickInput registeredInput in joysticks)
	        {
	            if (registeredInput.Description == source.Description &&
	                registeredInput.Source == null)
	            {
	                registeredInput.Source = source;
	                return;
	            }
	        }
	    }