mirror of
https://github.com/hyprwm/hyprland-plugins.git
synced 2026-05-07 19:28:00 +02:00
feat: [ROM] add button rendering from file
This commit is contained in:
parent
473804b359
commit
f75b64f702
1 changed files with 9 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue