Skip to content

Commit 808fd55

Browse files
committed
Overlay: add bg to text instead of using ugly outline, fix opacity setting maximum
1 parent b59ea15 commit 808fd55

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/overlay/chatroom.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,19 @@ class ChatRoom : public OverlayWindow
189189
const auto& msg = *it;
190190

191191
if (Overlay::ChatHideBackground)
192-
DrawTextWithOutline(msg.content.c_str(), ImVec4(0.0f, 0.0f, 0.0f, 1.0f), ImVec4(1.0f, 1.0f, 1.0f, 1.0f));// 0xFF000000, 0xFFFFFFFF);
192+
{
193+
ImVec2 textSize = ImGui::CalcTextSize(msg.content.c_str());
194+
ImVec2 pos = ImGui::GetCursorScreenPos();
195+
196+
// Draw the background rectangle
197+
ImGui::GetWindowDrawList()->AddRectFilled(
198+
pos,
199+
ImVec2(pos.x + textSize.x, pos.y + textSize.y + ImGui::GetStyle().ItemSpacing.y),
200+
ImGui::ColorConvertFloat4ToU32(ImGui::GetStyle().Colors[ImGuiCol_FrameBg])
201+
);
202+
203+
ImGui::TextWrapped("%s", msg.content.c_str());
204+
}
193205
else
194206
ImGui::TextWrapped("%s", msg.content.c_str());
195207
}

src/overlay/overlay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class UISettingsWindow : public OverlayWindow
149149

150150
ImGui::PopStyleColor();
151151

152-
settingsChanged |= ImGui::SliderFloat("Overlay Opacity", &Overlay::GlobalOpacity, 0.1f, 5.0f);
152+
settingsChanged |= ImGui::SliderFloat("Overlay Opacity", &Overlay::GlobalOpacity, 0.1f, 1.0f);
153153

154154
ImGui::TreePop();
155155
}

0 commit comments

Comments
 (0)