diff options
-rw-r--r-- | core/input/godotcontrollerdb.txt | 3 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 13 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.h | 1 | ||||
-rw-r--r-- | platform/windows/key_mapping_windows.cpp | 2 |
4 files changed, 15 insertions, 4 deletions
diff --git a/core/input/godotcontrollerdb.txt b/core/input/godotcontrollerdb.txt index f6411e2429..adc3649d64 100644 --- a/core/input/godotcontrollerdb.txt +++ b/core/input/godotcontrollerdb.txt @@ -1,6 +1,9 @@ # Game Controller DB for Godot in SDL 2.0.10 format # Source: https://github.com/godotengine/godot +# Windows +__XINPUT_DEVICE__,XInput Gamepad,a:b12,b:b13,x:b14,y:b15,start:b4,back:b5,leftstick:b6,rightstick:b7,leftshoulder:b8,rightshoulder:b9,dpup:b0,dpdown:b1,dpleft:b2,dpright:b3,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,platform:Windows, + # Javascript Default HTML5 Gamepad, Default Mapping,leftx:a0,lefty:a1,dpdown:b13,rightstick:b11,rightshoulder:b5,rightx:a2,start:b9,righty:a3,dpleft:b14,lefttrigger:a6,x:b2,dpup:b12,back:b8,leftstick:b10,leftshoulder:b4,y:b3,a:b0,dpright:b15,righttrigger:a7,b:b1,platform:Javascript, c2a94d6963726f736f66742058626f78,Wireless X360 Controller,leftx:a0,lefty:a1,dpdown:b14,rightstick:b10,rightshoulder:b5,rightx:a3,start:b7,righty:a4,dpleft:b11,lefttrigger:a2,x:b2,dpup:b13,back:b6,leftstick:b9,leftshoulder:b4,y:b3,a:b0,dpright:b12,righttrigger:a5,b:b1,platform:Javascript, diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index 55b50f526c..ead3813734 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -51,7 +51,6 @@ #include "scene/gui/subviewport_container.h" #include "scene/resources/packed_scene.h" #include "scene/resources/surface_tool.h" -#include "servers/display_server.h" #define DISTANCE_DEFAULT 4 @@ -196,12 +195,20 @@ void ViewportRotationControl::_gui_input(Ref<InputEvent> p_event) { _update_focus(); } orbiting = false; + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); + Input::get_singleton()->warp_mouse_position(orbiting_mouse_start); + } } } const Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid()) { if (orbiting) { + if (Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_VISIBLE) { + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED); + orbiting_mouse_start = mm->get_global_position(); + } viewport->_nav_orbit(mm, viewport->_get_warped_mouse_motion(mm)); focused_axis = -1; } else { @@ -2210,14 +2217,14 @@ void Node3DEditorViewport::set_freelook_active(bool active_now) { } // Hide mouse like in an FPS (warping doesn't work) - DisplayServer::get_singleton()->mouse_set_mode(DisplayServer::MOUSE_MODE_CAPTURED); + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_CAPTURED); } else if (freelook_active && !active_now) { // Sync camera cursor to cursor to "cut" interpolation jumps due to changing referential cursor = camera_cursor; // Restore mouse - DisplayServer::get_singleton()->mouse_set_mode(DisplayServer::MOUSE_MODE_VISIBLE); + Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); } freelook_active = active_now; diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 71da14ae1a..fdc0741651 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -158,6 +158,7 @@ class ViewportRotationControl : public Control { Node3DEditorViewport *viewport = nullptr; Vector<Color> axis_colors; Vector<int> axis_menu_options; + Vector2i orbiting_mouse_start; bool orbiting = false; int focused_axis = -2; diff --git a/platform/windows/key_mapping_windows.cpp b/platform/windows/key_mapping_windows.cpp index da63e92622..92a2585745 100644 --- a/platform/windows/key_mapping_windows.cpp +++ b/platform/windows/key_mapping_windows.cpp @@ -130,7 +130,7 @@ static _WinTranslatePair _vk_to_keycode[] = { { KEY_MASK_META, VK_LWIN }, //(0x5B) { KEY_MASK_META, VK_RWIN }, //(0x5C) - //VK_APPS (0x5D) + { KEY_MENU, VK_APPS }, //(0x5D) { KEY_STANDBY, VK_SLEEP }, //(0x5F) { KEY_KP_0, VK_NUMPAD0 }, //(0x60) { KEY_KP_1, VK_NUMPAD1 }, //(0x61) |