From 127465b0eb2fedba5ded9ca9500f90f8900e5a9c Mon Sep 17 00:00:00 2001 From: Sylvessa <225480449+sylvessa@users.noreply.github.com> Date: Mon, 23 Mar 2026 17:54:46 -0500 Subject: add advanced tooltips, F3+H combo, and handle settings (#1389) --- Minecraft.Client/Windows64/KeyboardMouseInput.cpp | 7 +++++ Minecraft.Client/Windows64/KeyboardMouseInput.h | 2 ++ Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 34 ++++++++++++++++++---- 3 files changed, 37 insertions(+), 6 deletions(-) (limited to 'Minecraft.Client/Windows64') diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp index 54191ebc..be6efe90 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.cpp +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.cpp @@ -234,6 +234,13 @@ bool KeyboardMouseInput::IsKeyReleased(int vkCode) const return false; } +int KeyboardMouseInput::GetPressedKey() const +{ + for (int i = 0; i < MAX_KEYS; ++i) + if (m_keyPressed[i]) return i; + return 0; +} + bool KeyboardMouseInput::IsMouseButtonDown(int button) const { if (button >= 0 && button < MAX_MOUSE_BUTTONS) diff --git a/Minecraft.Client/Windows64/KeyboardMouseInput.h b/Minecraft.Client/Windows64/KeyboardMouseInput.h index 5c406983..e8b5f588 100644 --- a/Minecraft.Client/Windows64/KeyboardMouseInput.h +++ b/Minecraft.Client/Windows64/KeyboardMouseInput.h @@ -56,6 +56,8 @@ public: bool IsKeyPressed(int vkCode) const; bool IsKeyReleased(int vkCode) const; + int GetPressedKey() const; + bool IsMouseButtonDown(int button) const; bool IsMouseButtonPressed(int button) const; bool IsMouseButtonReleased(int button) const; diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 81430ffc..fa5f4ccc 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -36,6 +36,7 @@ //#include "NetworkManager.h" #include "..\..\Minecraft.Client\Tesselator.h" #include "..\..\Minecraft.Client\Options.h" +#include "..\Gui.h" #include "Sentient\SentientManager.h" #include "..\..\Minecraft.World\IntCache.h" #include "..\Textures.h" @@ -107,6 +108,7 @@ int g_iScreenHeight = 1080; // always matches the current window, even after a resize. int g_rScreenWidth = 1920; int g_rScreenHeight = 1080; +static bool f3ComboUsed = false; float g_iAspectRatio = static_cast(g_iScreenWidth) / g_iScreenHeight; static bool g_bResizeReady = false; @@ -1774,17 +1776,37 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, } // F3 toggles onscreen debug info - if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_INFO)) + if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_INFO)) f3ComboUsed = false; + + // f3 combo + if (g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_DEBUG_INFO)) { - if (const Minecraft* pMinecraft = Minecraft::GetInstance()) + switch (g_KBMInput.GetPressedKey()) { - if (pMinecraft->options) - { - pMinecraft->options->renderDebug = !pMinecraft->options->renderDebug; - } + // advanced tooltips + case 'H': + if (pMinecraft->options && app.GetGameStarted()) + { + pMinecraft->options->advancedTooltips = !pMinecraft->options->advancedTooltips; + pMinecraft->options->save(); + + const wstring msg = wstring(L"Advanced tooltips: ") + (pMinecraft->options->advancedTooltips ? L"shown" : L"hidden"); + const int primaryPad = ProfileManager.GetPrimaryPad(); + if (pMinecraft->gui) pMinecraft->gui->addMessage(msg, primaryPad); + + f3ComboUsed = true; + } + break; } } + // no combo + if (g_KBMInput.IsKeyReleased(KeyboardMouseInput::KEY_DEBUG_INFO) && !f3ComboUsed) + if (pMinecraft->options) + pMinecraft->options->renderDebug = !pMinecraft->options->renderDebug; + + + #ifdef _DEBUG_MENUS_ENABLED // F6 Open debug console if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_DEBUG_CONSOLE)) -- cgit v1.2.3