Slight readability improvements to GUI

This commit is contained in:
Yousef Khadadeh 2025-11-01 18:07:39 +03:00
parent 49d72e384c
commit 30f7856815
8 changed files with 37 additions and 19 deletions

View file

@ -115,6 +115,7 @@ void GUIManager::draw(SkCanvas* canvas) {
skia::textlayout::TextStyle tStyle;
tStyle.setFontSize(config->fontSize);
tStyle.setFontFamilies({SkString{"Roboto"}});
tStyle.setColor(convert_vec4<SkColor4f>(config->textColor).toSkColor());
pStyle.setTextStyle(tStyle);
skia::textlayout::ParagraphBuilderImpl a(pStyle, io->fontCollection, SkUnicodes::ICU::Make());
@ -272,6 +273,10 @@ void GUIManager::text_label_color(const std::string& val, const SkColor4f& color
CLAY_TEXT(strArena.std_str_to_clay_str(val), CLAY_TEXT_CONFIG({.textColor = convert_vec4<Clay_Color>(color), .fontSize = io->fontSize }));
}
void GUIManager::text_label_light(const std::string& val) {
CLAY_TEXT(strArena.std_str_to_clay_str(val), CLAY_TEXT_CONFIG({.textColor = convert_vec4<Clay_Color>(io->theme->frontColor2), .fontSize = io->fontSize }));
}
void GUIManager::text_label(const std::string& val) {
CLAY_TEXT(strArena.std_str_to_clay_str(val), CLAY_TEXT_CONFIG({.textColor = convert_vec4<Clay_Color>(io->theme->frontColor1), .fontSize = io->fontSize }));
}
@ -287,6 +292,17 @@ void GUIManager::text_label_centered(const std::string& val) {
}
}
void GUIManager::text_label_light_centered(const std::string& val) {
CLAY({
.layout = {
.sizing = {.width = CLAY_SIZING_GROW(0), .height = CLAY_SIZING_FIT(0) },
.childAlignment = {.x = CLAY_ALIGN_X_CENTER, .y = CLAY_ALIGN_Y_CENTER},
}
}) {
CLAY_TEXT(strArena.std_str_to_clay_str(val), CLAY_TEXT_CONFIG({.textColor = convert_vec4<Clay_Color>(io->theme->frontColor2), .fontSize = io->fontSize }));
}
}
bool GUIManager::radio_button(const std::string& id, bool val, const std::function<void()>& elemUpdate) {
push_id(id);
RadioButton* e = insert_element<RadioButton>();