summaryrefslogtreecommitdiffstats
path: root/game/client/chat.cc
diff options
context:
space:
mode:
authoruntodesu <kirill@untode.su>2025-03-15 16:59:59 +0500
committeruntodesu <kirill@untode.su>2025-03-15 16:59:59 +0500
commite53cca0ec8b4186cf79b6f927d74483f1301d5f6 (patch)
treea58bc914d7e21eea381470c8089d5b6d1b5c8bd3 /game/client/chat.cc
parent7ca5d9cdea5a26183808e06d7fb055674823ed5d (diff)
downloadvoxelius-e53cca0ec8b4186cf79b6f927d74483f1301d5f6.tar.bz2
voxelius-e53cca0ec8b4186cf79b6f927d74483f1301d5f6.zip
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
Diffstat (limited to 'game/client/chat.cc')
-rw-r--r--game/client/chat.cc15
1 files changed, 13 insertions, 2 deletions
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<float>(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));