feat: [ROM] add button rendering from file

This commit is contained in:
rom4ster 2026-05-02 23:10:04 -05:00
parent 473804b359
commit f75b64f702

View file

@ -388,10 +388,16 @@ void CHyprBar::renderBarButtonsText(CBox* barBox, const float scale, const float
noScaleOffset += BARBUTTONPADDING + button.size;
if ((!button.iconTex || button.iconTex->m_texID == 0) && !button.icon.empty()) {
// render icon
auto fgcol = button.userfg ? button.fgcol : (button.bgcol.r + button.bgcol.g + button.bgcol.b < 1) ? CHyprColor(0xFFFFFFFF) : CHyprColor(0xFF000000);
if (button.icon.starts_with("file://")) {
button.iconTex = g_pHyprOpenGL->loadAsset(button.icon.substr(6));
} else {
// render icon
auto fgcol = button.userfg ? button.fgcol : (button.bgcol.r + button.bgcol.g + button.bgcol.b < 1) ? CHyprColor(0xFFFFFFFF) : CHyprColor(0xFF000000);
button.iconTex = g_pHyprRenderer->renderText(button.icon, fgcol, std::round(button.size * 0.62 * scale), false, "sans", scaledButtonSize);
}
button.iconTex = g_pHyprRenderer->renderText(button.icon, fgcol, std::round(button.size * 0.62 * scale), false, "sans", scaledButtonSize);
}
if (!button.iconTex || button.iconTex->m_texID == 0)