//======================
    // GetJoystickButton
    // Returns true if the specified joystick button is pressed
    //======================
    public static bool GetJoystickButton(int joystickNumber, OVRGamepadController.Button button)
    {
        string fullName = PlatformPrefix + "Joy " + joystickNumber + ":" + OVRGamepadController.ButtonNames[(int)button];

        //DebugUtils.Print( "Checking button " + fullName );
        return(Input.GetButton(fullName));
    }
Example #2
0
 /// <summary>
 /// Adds a handler for joystick button input.
 /// </summary>
 public static void AddInputHandler(
     DeviceType dt,
     OVRGamepadController.Button joystickButton,
     OnKeyDown onDown,
     OnKeyHeld onHeld,
     OnKeyUp onUp)
 {
     keyInfos.Add(new KeyInfo(dt, joystickButton, onDown, onHeld, onUp));
 }
 // joystick button constructor
 public KeyInfo(eDeviceType inDeviceType,
                OVRGamepadController.Button inJoystickButton,
                OnKeyDown inDownHandler,
                OnKeyHeld inHeldHandler,
                OnKeyUp inUpHandler)
 {
     DeviceType     = inDeviceType;
     KeyName        = OVRGamepadController.ButtonNames[(int)inJoystickButton];
     MouseButton    = eMouseButton.None;
     JoystickButton = inJoystickButton;
     JoystickAxis   = OVRGamepadController.Axis.None;
     Threshold      = 1000.0f;
     WasDown        = false;
     DownHandler    = inDownHandler;
     HeldHandler    = inHeldHandler;
     UpHandler      = inUpHandler;
 }
Example #4
0
 /// <summary>
 /// Joystick axis constructor.
 /// </summary>
 public KeyInfo(
     DeviceType inDeviceType,
     OVRGamepadController.Axis inJoystickAxis,
     OnKeyDown inDownHandler,
     OnKeyHeld inHeldHandler,
     OnKeyUp inUpHandler)
 {
     deviceType     = inDeviceType;
     keyName        = OVRGamepadController.AxisNames[(int)inJoystickAxis];
     mouseButton    = MouseButton.None;
     joystickButton = OVRGamepadController.Button.None;
     joystickAxis   = inJoystickAxis;
     threshold      = 0.5f;
     wasDown        = false;
     downHandler    = inDownHandler;
     heldHandler    = inHeldHandler;
     upHandler      = inUpHandler;
 }
Example #5
0
 /// <summary>
 /// Mouse button constructor.
 /// </summary>
 public KeyInfo(
     DeviceType inDeviceType,
     MouseButton inMouseButton,
     OnKeyDown inDownHandler,
     OnKeyHeld inHeldHandler,
     OnKeyUp inUpHandler)
 {
     deviceType     = inDeviceType;
     keyName        = "Mouse Button " + (int)inMouseButton;
     mouseButton    = inMouseButton;
     joystickButton = OVRGamepadController.Button.None;
     joystickAxis   = OVRGamepadController.Axis.None;
     threshold      = 1000.0f;
     wasDown        = false;
     downHandler    = inDownHandler;
     heldHandler    = inHeldHandler;
     upHandler      = inUpHandler;
 }
		/// <summary>
		/// Joystick axis constructor.
		/// </summary>
		public KeyInfo(
				DeviceType inDeviceType,
				OVRGamepadController.Axis inJoystickAxis,
				OnKeyDown inDownHandler,
				OnKeyHeld inHeldHandler,
				OnKeyUp inUpHandler)
		{
			deviceType = inDeviceType;
			keyName = OVRGamepadController.AxisNames[(int)inJoystickAxis];
			mouseButton = MouseButton.None;
			joystickButton = OVRGamepadController.Button.None;
			joystickAxis = inJoystickAxis;
			threshold = 0.5f;
			wasDown = false;
			downHandler = inDownHandler;
			heldHandler = inHeldHandler;
			upHandler = inUpHandler;
		}
		/// <summary>
		/// Mouse button constructor.
		/// </summary>
		public KeyInfo(
				DeviceType inDeviceType,
				MouseButton inMouseButton,
				OnKeyDown inDownHandler,
				OnKeyHeld inHeldHandler,
				OnKeyUp inUpHandler)
		{
			deviceType = inDeviceType;
			keyName = "Mouse Button " + (int)inMouseButton;
			mouseButton = inMouseButton;
			joystickButton = OVRGamepadController.Button.None;
			joystickAxis = OVRGamepadController.Axis.None;
			threshold = 1000.0f;
			wasDown = false;
			downHandler = inDownHandler;
			heldHandler = inHeldHandler;
			upHandler = inUpHandler;
		}
Example #8
0
 /// <summary>
 /// Delegate for OVRGamepadController.
 /// This only exists for legacy compatibility with OVRGamepadController.
 /// </summary>
 public static bool ReadJoystickButton(OVRGamepadController.Button button)
 {
     //if (verbose)
     //Debug.Log("OVRInputControl.ReadJoystickButton");
     return(GetJoystickButton(1, button));
 }
 //======================
 // ReadJoystickButton
 // delegate for OVRGamepadController
 // This only exists for legacy compatibility with OVRGamepadController.
 //======================
 public static bool ReadJoystickButton(OVRGamepadController.Button button)
 {
     //DebugUtils.Print( "InputControl.ReadJoystickButton" );
     return(GetJoystickButton(1, button));
 }
Example #10
0
        // joystick axis constructor
        public KeyInfo( eDeviceType inDeviceType, 
						OVRGamepadController.Axis inJoystickAxis,
						OnKeyDown inDownHandler, 
						OnKeyHeld inHeldHandler, 
						OnKeyUp inUpHandler )
        {
            DeviceType = inDeviceType;
                    KeyName = OVRGamepadController.AxisNames[(int)inJoystickAxis];
                    MouseButton = eMouseButton.None;
                    JoystickButton = OVRGamepadController.Button.None;
                    JoystickAxis = inJoystickAxis;
                    Threshold = 0.5f;
                    WasDown = false;
                    DownHandler = inDownHandler;
                    HeldHandler = inHeldHandler;
                    UpHandler = inUpHandler;
        }
Example #11
0
        // mouse button constructor
        public KeyInfo( eDeviceType inDeviceType, 
						eMouseButton inMouseButton,
						OnKeyDown inDownHandler, 
						OnKeyHeld inHeldHandler, 
						OnKeyUp inUpHandler )
        {
            DeviceType = inDeviceType;
                    KeyName = "Mouse Button " + (int)inMouseButton;
                    MouseButton = inMouseButton;
                    JoystickButton = OVRGamepadController.Button.None;
                    JoystickAxis = OVRGamepadController.Axis.None;
                    Threshold = 1000.0f;
                    WasDown = false;
                    DownHandler = inDownHandler;
                    HeldHandler = inHeldHandler;
                    UpHandler = inUpHandler;
        }