public static bool GetStickPress(ControllerState4 controllerState) { RawButton stickButton = RawButton.LThumbstick | RawButton.RThumbstick; bool stickButtonValue = (controllerState.Buttons & (uint)stickButton) != 0; return(stickButtonValue); }
private static bool GetResolvedButtonUp(Button virtualMask, RawButton rawMask, Controller controllerMask) { bool up = false; if ((controllerMask & Controller.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawButton resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawButton)controller.currentState.Buttons & resolvedMask) != 0) { return false; } if ((((RawButton)controller.currentState.Buttons & resolvedMask) == 0) && (((RawButton)controller.previousState.Buttons & resolvedMask) != 0)) { up = true; } } } return up; }
/// <summary> /// Gets the current up state of the given raw button mask with the given controller mask. /// Returns true if any masked button was released this frame on any masked controller and no other masked button is still down this frame. /// </summary> public static bool GetUp(RawButton rawMask, Controller controllerMask = Controller.Active) { return GetResolvedButtonUp(Button.None, rawMask, controllerMask); }
private bool GetResolvedButtonDown(Button virtualMask, RawButton rawMask, ControllerType controllerMask) { if (!OVRManager.instance.isVRPresent) return false; bool down = false; if ((controllerMask & ControllerType.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawButton resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawButton)controller.previousInputState.Buttons & resolvedMask) != 0) { return false; } if ((((RawButton)controller.currentInputState.Buttons & resolvedMask) != 0) && (((RawButton)controller.previousInputState.Buttons & resolvedMask) == 0)) { down = true; } } } return down; }
/// <summary> /// Gets the current up state of the given raw button mask with the given controller mask. /// Returns true if any masked button was released this frame on any masked controller and no other masked button is still down this frame. /// </summary> public static bool GetUp(RawButton rawMask, ControllerType controllerMask) { return OVRManager.input.GetResolvedButtonUp(Button.None, rawMask, controllerMask); }
/// <summary> /// Gets the current down state of the given raw button mask with the Active controller. /// Returns true if any masked button was pressed this frame on the Active controller and no masked button was previously down last frame. /// </summary> public static bool GetDown(RawButton rawMask) { return OVRManager.input.GetResolvedButtonDown(Button.None, rawMask, ControllerType.Active); }
private static Window CreateWindow2(string path) { const int fontSize = 14; var window = new Window("window2", Path.Combine(path, @"generic/bg.raw")); window.AddChild(new RawButton("window2_home", Path.Combine(path, @"generic/home.raw"), Path.Combine(path, @"generic/home.raw"), 383, 247) { OnRelease = () => mApplication.SetFocusedWindow("window1") }); var window2_bt_sample = new RawButton("window2_bt_sample", Path.Combine(path, @"2/input_pacient.raw"), Path.Combine(path, @"2/input_pacient.raw"), 18, ToVgY(84)); var window2_bt_sample_text_render = new TextArea("window2_bt_sample_text_render", null, 25, ToVgY(72), 427) { Size = fontSize, Text = "sample1" }; var window2_bt_executor = new RawButton("window2_bt_executor", Path.Combine(path, @"2/input_executor.raw"), Path.Combine(path, @"2/input_executor.raw"), 18, ToVgY(121)); var window2_bt_executor_text_render = new TextArea("window2_bt_executor_text_render", null, 25, ToVgY(109), 427) { Size = fontSize }; // TODO: доступные методики загружаются только исключительно на старте приложения var window2_meth_list = new ListWith3Items("window2_meth_list", 18, ToVgY(160), mDeviceControl.GetAvailMethodologies(), Path.Combine(path, @"2/list.raw"), Path.Combine(path, @"2/list_clean.raw"), Path.Combine(path, @"2/list_pressed.raw"), Path.Combine(path, @"2/list1.raw"), Path.Combine(path, @"2/list2.raw"), Path.Combine(path, @"2/list3.raw")); window.OnShow = () => { var settings = mDeviceControl.SettingsStorage.Load(); window2_bt_executor_text_render.Text = settings.LastUsedExecutor; window2_meth_list.SelectedMethodology = settings.LastUsedMethodology; }; window2_bt_sample.AddChild(window2_bt_sample_text_render); window2_bt_executor.AddChild(window2_bt_executor_text_render); window.AddChild(window2_bt_sample); window.AddChild(window2_bt_executor); window.AddChild(window2_meth_list); window.AddChild(new RawButton("window2_bt_next", Path.Combine(path, @"RawButtons/bt_onwards.raw"), Path.Combine(path, @"RawButtons/bt_onwards_pr.raw"), 350, 5) { OnRelease = () => { var meth = window2_meth_list.SelectedMethodology; if (meth == null) { return; } var executor = window2_bt_executor_text_render.Text; if (string.IsNullOrEmpty(executor)) { return; } if (string.IsNullOrEmpty(window2_bt_sample_text_render.Text)) { return; } mDeviceControl.SetMeasureData(window2_bt_sample_text_render.Text, executor, meth); mMeasureController.Reset(); mApplication.SetFocusedWindow("window3"); } }); window2_bt_sample.OnRelease = () => { window2_bt_sample.ChangeUpImg(Path.Combine(path, @"2/input.raw")); window2_bt_sample.ChangeDownImg(Path.Combine(path, @"2/input.raw")); mKeyboardWindow.OnEnter = returnText => { if (!string.IsNullOrWhiteSpace(returnText)) { window2_bt_sample_text_render.Text = returnText; } }; mKeyboardWindow.ReturnWindow = "window2"; mKeyboardWindow.Text = "";// window2_bt_sample_text_render.Text; mApplication.SetFocusedWindow("keyboard_window"); }; window2_bt_executor.OnRelease = () => { window2_bt_executor.ChangeUpImg(Path.Combine(path, @"2/input.raw")); window2_bt_executor.ChangeDownImg(Path.Combine(path, @"2/input.raw")); var rv = mApplication.GetWindows().First(w => w.Name == "window9_2") as Window; if (rv == null) { return; } rv.OnShow(); mApplication.SetFocusedWindow(rv); }; return(window); }
private bool GetResolvedButton(Button virtualMask, RawButton rawMask, Controller controllerMask) { if (!OVRManager.isHmdPresent) return false; if ((controllerMask & Controller.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawButton resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawButton)controller.currentInputState.Buttons & resolvedMask) != 0) { return true; } } } return false; }
private bool GetResolvedButtonUp(Button virtualMask, RawButton rawMask, Controller controllerMask) { #if OVR_LEGACY if (!OVRManager.instance.isVRPresent) return false; #else if (!OVRManager.isHmdPresent) return false; #endif bool up = false; if ((controllerMask & Controller.Active) != 0) controllerMask |= activeControllerType; for (int i = 0; i < controllers.Count; i++) { OVRControllerBase controller = controllers[i]; if (ShouldResolveController(controller.controllerType, controllerMask)) { RawButton resolvedMask = rawMask | controller.ResolveToRawMask(virtualMask); if (((RawButton)controller.currentInputState.Buttons & resolvedMask) != 0) { return false; } if ((((RawButton)controller.currentInputState.Buttons & resolvedMask) == 0) && (((RawButton)controller.previousInputState.Buttons & resolvedMask) != 0)) { up = true; } } } return up; }
/// <summary> /// Gets the current state of the given raw button mask with the given controller mask. /// Returns true if any masked button is down on any masked controllers. /// </summary> public static bool Get(RawButton rawMask, Controller controllerMask = Controller.Active) { return OVRManager.input.GetResolvedButton(Button.None, rawMask, controllerMask); }