update client visuals, performance and diagnostics
This commit is contained in:
1 parent
361892bf0b
commit
875bab0310
155 files changed
+40855
-421
No files matched your search
+30
-12
@@ -2,6 +2,7 @@
|
||||
#include <windows.h>
|
||||
#include <string>
|
||||
#include "imgui.h"
|
||||
#include "misc/freetype/imgui_freetype.h"
|
||||
|
||||
// optional fallback if the Segoe UI files can't be found
|
||||
#if __has_include("../font_data.h")
|
||||
@@ -14,14 +15,24 @@ int amnesia_fallback_font_size();
|
||||
|
||||
namespace fonts {
|
||||
|
||||
inline constexpr float k_body_size = 14.f; // launcher base font size
|
||||
inline constexpr float k_label_size = 11.f; // the small uppercase labels
|
||||
inline constexpr float k_heading_size = 20.f;
|
||||
inline constexpr float k_body_size = 13.f; // reference menu Verdana size
|
||||
inline constexpr float k_label_size = 11.f; // compact secondary labels
|
||||
inline constexpr float k_heading_size = 13.f;
|
||||
|
||||
inline ImFont* body = nullptr; // Segoe UI
|
||||
inline ImFont* semibold = nullptr; // Segoe UI Semibold (buttons, module names)
|
||||
inline ImFont* label = nullptr; // Segoe UI Bold
|
||||
inline ImFont* heading = nullptr; // Segoe UI Semibold, larger
|
||||
inline ImFont* body = nullptr; // Verdana, matching the reference menu
|
||||
inline ImFont* semibold = nullptr;
|
||||
inline ImFont* label = nullptr;
|
||||
inline ImFont* heading = nullptr;
|
||||
inline ImFont* media = nullptr; // original glyphs for song/artist metadata
|
||||
|
||||
inline void lowercase_display(ImFont* font) {
|
||||
// Render capitals with their lowercase glyph, including matching advance
|
||||
// widths for layout, wrapping and text-input caret placement. Keep source
|
||||
// strings intact: module/profile identifiers and external data retain case.
|
||||
// Apply before any glyphs are baked, at every font weight and size.
|
||||
for (ImWchar upper = 'A'; upper <= 'Z'; ++upper)
|
||||
font->AddRemapCodepoint(upper, upper + ('a' - 'A'));
|
||||
}
|
||||
|
||||
// PushFont changed signature in ImGui 1.92 (fonts became size-flexible)
|
||||
inline void push_font(ImFont* font, float size) {
|
||||
@@ -51,11 +62,13 @@ namespace fonts {
|
||||
inline ImFont* load_one(ImGuiIO& io, const char* file, float size) {
|
||||
std::string path;
|
||||
if (windows_font_path(file, path)) {
|
||||
if (ImFont* f = io.Fonts->AddFontFromFileTTF(path.c_str(), size)) return f;
|
||||
ImFontConfig config;config.PixelSnapH=true;
|
||||
if (ImFont* f = io.Fonts->AddFontFromFileTTF(path.c_str(), size,&config)) return f;
|
||||
}
|
||||
#if AMNESIA_HAS_FONT
|
||||
ImFontConfig cfg;
|
||||
cfg.FontDataOwnedByAtlas = false;
|
||||
cfg.PixelSnapH = true;
|
||||
return io.Fonts->AddFontFromMemoryTTF((void*)amnesia_fallback_font(), amnesia_fallback_font_size(), size, &cfg);
|
||||
#else
|
||||
return io.Fonts->AddFontDefault();
|
||||
@@ -65,10 +78,15 @@ namespace fonts {
|
||||
// after ImGui::CreateContext(), before the backends are initialized
|
||||
inline void load() {
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
body = load_one(io, "segoeui.ttf", k_body_size);
|
||||
semibold = load_one(io, "seguisb.ttf", k_body_size);
|
||||
label = load_one(io, "segoeuib.ttf", k_label_size);
|
||||
heading = load_one(io, "seguisb.ttf", k_heading_size);
|
||||
io.Fonts->SetFontLoader(ImGuiFreeType::GetFontLoader());
|
||||
// Strong mono-grid hinting with native Verdana hints; keep grayscale antialiasing.
|
||||
io.Fonts->FontLoaderFlags = ImGuiFreeTypeLoaderFlags_NoAutoHint | ImGuiFreeTypeLoaderFlags_MonoHinting;
|
||||
body = load_one(io, "verdana.ttf", k_body_size);
|
||||
semibold = load_one(io, "verdana.ttf", k_body_size);
|
||||
label = load_one(io, "verdana.ttf", k_label_size);
|
||||
heading = load_one(io, "verdana.ttf", k_heading_size);
|
||||
for (ImFont* font : {body, semibold, label, heading}) lowercase_display(font);
|
||||
media = load_one(io, "verdana.ttf", k_body_size);
|
||||
io.FontDefault = body;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user