From e53cca0ec8b4186cf79b6f927d74483f1301d5f6 Mon Sep 17 00:00:00 2001 From: untodesu Date: Sat, 15 Mar 2025 16:59:59 +0500 Subject: Add a key binding to show/hide HUD elements - Just like in Minecraft, by default one would press the F1 key to toggle HUD elements (including player_target) visibility - Consequently moved player_target::render back into itself - Fixed-upped some language key-value pairs --- game/client/chat.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'game/client/chat.cc') diff --git a/game/client/chat.cc b/game/client/chat.cc index 64fba2a..177db08 100644 --- a/game/client/chat.cc +++ b/game/client/chat.cc @@ -205,8 +205,19 @@ void client_chat::layout(void) auto fadeout_seconds = 10.0f; auto fadeout = std::exp(-1.0f * std::pow(1.0e-6 * static_cast(globals::curtime - it->spawn) / fadeout_seconds, 10.0f)); - auto rect_alpha = ((globals::gui_screen == GUI_CHAT) ? (0.75f) : (0.50f * fadeout)); - auto text_alpha = ((globals::gui_screen == GUI_CHAT) ? (1.00f) : (1.00f * fadeout)); + + float rect_alpha; + float text_alpha; + + if(globals::gui_screen == GUI_CHAT) { + rect_alpha = 0.75f; + text_alpha = 1.00f; + } + else if(!client_game::hide_hud) { + rect_alpha = 0.50f * fadeout; + text_alpha = 1.00f * fadeout; + } + else break; auto rect_col = ImGui::GetColorU32(ImGuiCol_FrameBg, rect_alpha); auto text_col = ImGui::GetColorU32(ImVec4(it->color.x, it->color.y, it->color.z, it->color.w * text_alpha)); -- cgit