aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorndren <andreien@proton.me>2022-12-24 08:38:30 +0000
committerGitHub <noreply@github.com>2022-12-24 09:38:30 +0100
commit62ee02b8bae50f519bf88c2b7a8b22bb179f6241 (patch)
tree6f48f14d96e279615435ef87fd20e877b3784de3 /src
parent475f85fc91b56b4626ddad105bb11f1d1fd913fd (diff)
downloadminetest-62ee02b8bae50f519bf88c2b7a8b22bb179f6241.tar.xz
Set and unset relative mouse mode where necessary (#12636)
* Set and unset relative mouse mode where necessary Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src')
-rw-r--r--src/client/clientlauncher.cpp4
-rw-r--r--src/client/game.cpp6
2 files changed, 10 insertions, 0 deletions
diff --git a/src/client/clientlauncher.cpp b/src/client/clientlauncher.cpp
index 514607fc3..94d2a38c9 100644
--- a/src/client/clientlauncher.cpp
+++ b/src/client/clientlauncher.cpp
@@ -552,6 +552,10 @@ void ClientLauncher::main_menu(MainMenuData *menudata)
#ifndef ANDROID
m_rendering_engine->get_raw_device()->getCursorControl()->setVisible(true);
#endif
+ // Set absolute mouse mode
+#if IRRLICHT_VERSION_MT_REVISION >= 9
+ m_rendering_engine->get_raw_device()->getCursorControl()->setRelativeMode(false);
+#endif
/* show main menu */
GUIEngine mymenu(&input->joystick, guiroot, m_rendering_engine, &g_menumgr, menudata, *kill);
diff --git a/src/client/game.cpp b/src/client/game.cpp
index fc911fc03..e7fc31774 100644
--- a/src/client/game.cpp
+++ b/src/client/game.cpp
@@ -2520,6 +2520,12 @@ void Game::checkZoomEnabled()
void Game::updateCameraDirection(CameraOrientation *cam, float dtime)
{
+#if IRRLICHT_VERSION_MT_REVISION >= 9
+ if (isMenuActive())
+ device->getCursorControl()->setRelativeMode(false);
+ else
+ device->getCursorControl()->setRelativeMode(true);
+#endif
if ((device->isWindowActive() && device->isWindowFocused()
&& !isMenuActive()) || input->isRandom()) {