Search the Community
Showing results for tags 'mouse_handle'.
-
Hi, I am experimenting with UI. Using code below I try to switch the mouse state when i press F After reading these docs and looking in the sample i have not found a solution https://developer.unigine.com/en/docs/2.12/code/usage/mouse_customization/index?rlang=cpp https://developer.unigine.com/en/docs/2.12/start/programmer/user_inputs?rlang=cs https://developer.unigine.com/en/docs/2.12/start/programmer/ui?rlang=cpp The states only seem to work the first cycle. And i do not find what I am missing. private void Update() { if (Input.IsKeyDown(WidgedMode)) { switch (ControlsApp.MouseHandle) { case Input.MOUSE_HANDLE.GRAB: Input.MouseHandle = Input.MOUSE_HANDLE.SOFT; //ControlsApp.MouseHandle = Input.MOUSE_HANDLE.SOFT; Log.Message($"MOUSE_HANDLE.GRAB -> SOFT\n"); break; case Input.MOUSE_HANDLE.SOFT: Input.MouseHandle = Input.MOUSE_HANDLE.USER; //ControlsApp.MouseHandle = Input.MOUSE_HANDLE.USER; Log.Message($"MOUSE_HANDLE.SOFT -> USER\n"); break; case Input.MOUSE_HANDLE.USER: Input.MouseHandle = Input.MOUSE_HANDLE.GRAB; //ControlsApp.MouseHandle = Input.MOUSE_HANDLE.GRAB; Log.Message($"MOUSE_HANDLE.USER -> GRAB\n"); break; default: break; } } } Admitting i do not understand this sample in the docs /// Method toggling the mouse cursor's state public void ToggleMouseCursor() { // getting current mouse state bool enabled = controls_app.MouseEnabled; // toggling movement restriction to the application window area App.SetMouseGrab(enabled ? 0 : 1); // toggling mouse interaction with GUI elements gui.MouseEnabled = enabled; // toggling mouse control controls_app.MouseEnabled = !enabled; } Unigine v2.12.0.2 Thanks for the help
-
[SOLVED] Automatic Mouse Grab without requiring clicking on window
Vadya_Rus posted a topic in C# Programming
Does anyone have any idea how I can properly have the mouse grabbed within the app without needing to click inside the window after changing the MouseHandle? I've followed this guide and I've been able to get the mouse to grab and everything works properly. The caveat is that the mouse is only grabbed after clicking inside of the window after changing the MouseHandle. I've tried to do it by directly setting App.MouseGrab to true and it has most of the behavior that I'm looking for. The mouse is grabbed immediately and works, but once I move the mouse to the edge of the screen, I'm no longer able to rotate the camera.- 4 replies
-
- mouse_handle
- mouse
-
(and 1 more)
Tagged with: