diff --git a/client/include/core/Config.hpp b/client/include/core/Config.hpp index 79bc4bcd5..595986fdc 100644 --- a/client/include/core/Config.hpp +++ b/client/include/core/Config.hpp @@ -30,6 +30,9 @@ namespace Config { extern bool isFlyModeEnabled; extern bool isNoClipEnabled; + // Interface + extern bool isBlockInfoWidgetEnabled; + // Graphics extern u16 renderDistance; extern bool isTorchSmoothLightingEnabled; diff --git a/client/include/states/SettingsMenuState.hpp b/client/include/states/SettingsMenuState.hpp index 2089db803..55aa978f3 100644 --- a/client/include/states/SettingsMenuState.hpp +++ b/client/include/states/SettingsMenuState.hpp @@ -42,6 +42,7 @@ class SettingsMenuState : public InterfaceState { void addMainButtons(); void addGameplayButtons(); + void addInterfaceButtons(); void addGraphicsButtons(); void addInputButtons(); diff --git a/client/source/core/Config.cpp b/client/source/core/Config.cpp index 7c2bf00a7..d90087c5c 100644 --- a/client/source/core/Config.cpp +++ b/client/source/core/Config.cpp @@ -26,6 +26,9 @@ bool Config::isFlyModeEnabled = false; bool Config::isNoClipEnabled = false; +// Interface +bool Config::isBlockInfoWidgetEnabled = true; + // Graphics u16 Config::renderDistance = 8; bool Config::isTorchSmoothLightingEnabled = true; @@ -57,6 +60,8 @@ void Config::loadConfigFromFile(const char *file) { isFlyModeEnabled = lua["isFlyModeEnabled"].get_or(isFlyModeEnabled); isNoClipEnabled = lua["isNoClipEnabled"].get_or(isNoClipEnabled); + isBlockInfoWidgetEnabled = lua["isBlockInfoWidgetEnabled"].get_or(isBlockInfoWidgetEnabled); + renderDistance = lua["renderDistance"].get_or(renderDistance); isTorchSmoothLightingEnabled = lua["isTorchSmoothLightingEnabled"].get_or(isTorchSmoothLightingEnabled); isSunSmoothLightingEnabled = lua["isSunSmoothLightingEnabled"].get_or(isSunSmoothLightingEnabled); diff --git a/client/source/hud/HUD.cpp b/client/source/hud/HUD.cpp index 7e7903e69..59fad4f72 100644 --- a/client/source/hud/HUD.cpp +++ b/client/source/hud/HUD.cpp @@ -76,10 +76,12 @@ void HUD::update() { if (m_isDebugOverlayVisible) m_debugOverlay.update(); - m_blockInfoWidget.update(); + if (Config::isBlockInfoWidgetEnabled) { + m_blockInfoWidget.update(); - if (m_blockCursor.currentBlock() != m_blockInfoWidget.currentBlock()) - m_blockInfoWidget.setCurrentBlock(m_blockCursor.currentBlock()); + if (m_blockCursor.currentBlock() != m_blockInfoWidget.currentBlock()) + m_blockInfoWidget.setCurrentBlock(m_blockCursor.currentBlock()); + } } void HUD::draw(gk::RenderTarget &target, gk::RenderStates states) const { @@ -97,7 +99,9 @@ void HUD::draw(gk::RenderTarget &target, gk::RenderStates states) const { if (m_isDebugOverlayVisible) target.draw(m_debugOverlay, states); - target.draw(m_blockInfoWidget, states); + if (Config::isBlockInfoWidgetEnabled) + target.draw(m_blockInfoWidget, states); + target.draw(m_hotbar, states); target.draw(m_fpsText, states); target.draw(m_chat, states); diff --git a/client/source/states/SettingsMenuState.cpp b/client/source/states/SettingsMenuState.cpp index 3ddafc050..ff78f2e97 100644 --- a/client/source/states/SettingsMenuState.cpp +++ b/client/source/states/SettingsMenuState.cpp @@ -94,6 +94,11 @@ void SettingsMenuState::addMainButtons() { addGameplayButtons(); }); + m_menuWidget.addButton("Interface...", [this] (TextButton &) { + m_state = MenuState::Gameplay; + addInterfaceButtons(); + }); + m_menuWidget.addButton("Graphics...", [this] (TextButton &) { m_state = MenuState::Graphics; addGraphicsButtons(); @@ -112,6 +117,12 @@ void SettingsMenuState::addGameplayButtons() { addToggleButton("No Clip", Config::isNoClipEnabled, false); } +void SettingsMenuState::addInterfaceButtons() { + m_menuWidget.reset(1, 8); + + addToggleButton("Show block info", Config::isBlockInfoWidgetEnabled, false); +} + void SettingsMenuState::addGraphicsButtons() { m_menuWidget.reset(2, 8);