Skip to content

Commit b59ea15

Browse files
committed
Overlay: add Chat Font Size setting, remove test code
1 parent 318af3b commit b59ea15

File tree

3 files changed

+7
-48
lines changed

3 files changed

+7
-48
lines changed

src/overlay/chatroom.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ class ChatRoom : public OverlayWindow
161161
ImGuiWindowFlags_NoFocusOnAppearing |
162162
ImGuiWindowFlags_NoNav))
163163
{
164+
ImGui::SetWindowFontScale(Overlay::ChatFontSize);
164165
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -ImGui::GetFrameHeightWithSpacing()), false, ImGuiWindowFlags_HorizontalScrollbar);
165166

166167
// Get total available height of scroll region

src/overlay/overlay.cpp

Lines changed: 5 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ class UISettingsWindow : public OverlayWindow
157157
if (ImGui::TreeNodeEx("Notifications", ImGuiTreeNodeFlags_DefaultOpen))
158158
{
159159
settingsChanged |= ImGui::Checkbox("Enable Notifications", &Overlay::NotifyEnable);
160-
settingsChanged |= ImGui::SliderInt("Display Time", &Overlay::NotifyDisplayTime, 0, 60);
161160
settingsChanged |= ImGui::Checkbox("Enable Online Lobby Notifications", &Overlay::NotifyOnlineEnable);
161+
162+
settingsChanged |= ImGui::SliderInt("Display Time", &Overlay::NotifyDisplayTime, 0, 60);
162163
settingsChanged |= ImGui::SliderInt("Online Update Time", &Overlay::NotifyOnlineUpdateTime, 10, 60);
163164

164165
static const char* items[]{ "Never Hide", "Online Race", "Any Race" };
@@ -169,6 +170,7 @@ class UISettingsWindow : public OverlayWindow
169170

170171
if (ImGui::TreeNodeEx("Chat", ImGuiTreeNodeFlags_DefaultOpen))
171172
{
173+
settingsChanged |= ImGui::SliderFloat("Chat Font Size", &Overlay::ChatFontSize, 0.5f, 2.5f);
172174
settingsChanged |= ImGui::Checkbox("Hide Chat Background", &Overlay::ChatHideBackground);
173175

174176
ImGui::TreePop();
@@ -263,53 +265,6 @@ bool Overlay::render()
263265
// Notifications are rendered before any other window
264266
Notifications::instance.render();
265267

266-
if (overlay_visible)
267-
{
268-
if (ImGui::BeginMainMenuBar()) {
269-
if (ImGui::BeginMenu("File")) {
270-
if (ImGui::MenuItem("Open", "Ctrl+O")) {
271-
// Handle Open action
272-
}
273-
if (ImGui::MenuItem("Save", "Ctrl+S")) {
274-
// Handle Save action
275-
}
276-
if (ImGui::MenuItem("Exit")) {
277-
// Handle Exit action
278-
}
279-
ImGui::EndMenu();
280-
}
281-
282-
if (ImGui::BeginMenu("Edit")) {
283-
if (ImGui::MenuItem("Undo", "Ctrl+Z")) {
284-
// Handle Undo action
285-
}
286-
if (ImGui::MenuItem("Redo", "Ctrl+Y", false, false)) {
287-
// Disabled menu item (not clickable)
288-
}
289-
ImGui::Separator(); // Adds a separator line
290-
if (ImGui::MenuItem("Cut", "Ctrl+X")) {
291-
// Handle Cut action
292-
}
293-
if (ImGui::MenuItem("Copy", "Ctrl+C")) {
294-
// Handle Copy action
295-
}
296-
if (ImGui::MenuItem("Paste", "Ctrl+V")) {
297-
// Handle Paste action
298-
}
299-
ImGui::EndMenu();
300-
}
301-
302-
if (ImGui::BeginMenu("Help")) {
303-
if (ImGui::MenuItem("About")) {
304-
// Handle About action
305-
}
306-
ImGui::EndMenu();
307-
}
308-
309-
ImGui::EndMainMenuBar();
310-
}
311-
}
312-
313268
for (const auto& wnd : s_windows)
314269
wnd->render(overlay_visible);
315270

@@ -346,6 +301,7 @@ bool Overlay::settings_read()
346301
NotifyHideMode = ini.Get("Notifications", "HideMode", NotifyHideMode);
347302
NotifyUpdateCheck = ini.Get("Notifications", "CheckForUpdates", NotifyUpdateCheck);
348303

304+
ChatFontSize = ini.Get("Chat", "FontSize", ChatFontSize);
349305
ChatHideBackground = ini.Get("Chat", "HideBackground", ChatHideBackground);
350306

351307
CourseReplacementEnabled = ini.Get("CourseReplacement", "Enabled", CourseReplacementEnabled);
@@ -369,6 +325,7 @@ bool Overlay::settings_write()
369325
ini.Set("Notifications", "HideMode", NotifyHideMode);
370326
ini.Set("Notifications", "CheckForUpdates", NotifyUpdateCheck);
371327

328+
ini.Set("Chat", "FontSize", ChatFontSize);
372329
ini.Set("Chat", "HideBackground", ChatHideBackground);
373330

374331
ini.Set("CourseReplacement", "Enabled", CourseReplacementEnabled);

src/overlay/overlay.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class Overlay
3333
inline static char CourseReplacementCode[256] = { 0 };
3434

3535
inline static bool ChatHideBackground = false;
36+
inline static float ChatFontSize = 1.0f;
3637

3738
inline static bool IsActive = false;
3839

0 commit comments

Comments
 (0)