/// <summary> /// Gets the pressed buttons on the device. /// </summary> /// <returns></returns> public OvrButton GetButtonState() { OvrButton buttonsPressed = OvrButton.None; try { if (EnsureConnection()) { InputState input = new InputState(); bool success = false; Result res = _ovrWrapper.GetInputState(this._hmd, ControllerType.Active, ref input); if (res < Result.Success) { CloseConnection(); if (EnsureConnection()) { res = _ovrWrapper.GetInputState(this._hmd, ControllerType.Active, ref input); if (res >= Result.Success) { success = true; } } } else { success = true; } if (success) { buttonsPressed = (OvrButton)(input.Buttons); } } } catch (Exception ex) { //Whatever } return(buttonsPressed); }
public bool ShouldResetViewport() { OvrButton buttons = this.GetButtonState(); return((buttons & (OvrButton.B | OvrButton.Y)) != 0); }
public bool ShouldCreateScreenshot() { OvrButton buttons = this.GetButtonState(); return((buttons & (OvrButton.A | OvrButton.X)) != 0); }