diff --git a/client/source/states/GameState.cpp b/client/source/states/GameState.cpp index f4b35d126..0c31ad7e1 100644 --- a/client/source/states/GameState.cpp +++ b/client/source/states/GameState.cpp @@ -55,8 +55,8 @@ GameState::GameState(const std::string &host, int port) { void GameState::onEvent(const SDL_Event &event) { if (event.type == SDL_MOUSEMOTION) { if(SCREEN_WIDTH / 2 != event.motion.x || SCREEN_HEIGHT / 2 != event.motion.y) { - m_player.turnH(event.motion.xrel * 0.06); - m_player.turnV(-event.motion.yrel * 0.06); + m_player.turnH(event.motion.xrel * 0.01 * Config::mouseSensitivity); + m_player.turnV(-event.motion.yrel * 0.01 * Config::mouseSensitivity); gk::Mouse::resetToWindowCenter(); } diff --git a/client/source/states/SettingsMenuState.cpp b/client/source/states/SettingsMenuState.cpp index 3f2a82bc7..e4e791397 100644 --- a/client/source/states/SettingsMenuState.cpp +++ b/client/source/states/SettingsMenuState.cpp @@ -143,6 +143,11 @@ void SettingsMenuState::addInputButtons() { m_currentKeyButton = &button; }); } + + m_menuWidget.addButton("Mouse sensitivity: " + std::to_string(Config::mouseSensitivity), [] (TextButton &button) { + Config::mouseSensitivity = std::max(2, (Config::mouseSensitivity + 2) % 14); + button.setText("Mouse sensitivity: " + std::to_string(Config::mouseSensitivity)); + }); } TextButton &SettingsMenuState::addToggleButton(const std::string &text, bool &configOption, bool worldReloadRequested) { diff --git a/common/include/core/Config.hpp b/common/include/core/Config.hpp index 20f96c884..2d8ad9779 100644 --- a/common/include/core/Config.hpp +++ b/common/include/core/Config.hpp @@ -46,6 +46,7 @@ namespace Config { extern bool isWireframeModeEnabled; extern u16 renderDistance; extern float cameraFOV; + extern u8 mouseSensitivity; } #endif // CONFIG_HPP_ diff --git a/common/source/core/Config.cpp b/common/source/core/Config.cpp index fa6eb262c..b8bf8725c 100644 --- a/common/source/core/Config.cpp +++ b/common/source/core/Config.cpp @@ -26,4 +26,5 @@ bool Config::isAmbientOcclusionEnabled = false; bool Config::isWireframeModeEnabled = false; u16 Config::renderDistance = 8; float Config::cameraFOV = 70.0f; +u8 Config::mouseSensitivity = 8;