Add text shadow, fix font issues
This commit is contained in:
@@ -133,7 +133,7 @@ static void calculateAxisSizePreorder(const BzUIAxis axis, BzUINode *node) {
|
||||
break;
|
||||
case BZ_UI_SIZE_FIT:
|
||||
BZ_ASSERT(node->string);
|
||||
Vector2 size = MeasureTextEx(GetFontDefault(), node->string, node->style.fontSize, 2);
|
||||
Vector2 size = MeasureTextEx(node->style.font, node->string, node->style.fontSize, node->style.fontSpacing);
|
||||
compSize = (axis == BZ_UI_AXIS_X) ? size.x : size.y;
|
||||
break;
|
||||
case BZ_UI_SIZE_PARENT_PERCENT:
|
||||
@@ -357,11 +357,20 @@ static void renderNode(BzUI *ui, BzUINode *node) {
|
||||
if (inter->down) color = style->borderActiveColor;
|
||||
DrawRectangleRoundedLines(rect, style->roundness, 0, style->borderThickness, color);
|
||||
}
|
||||
if (node->flags & BZ_UI_DRAW_TEXT_SHADOW) {
|
||||
Color color = style->textShadowColor;
|
||||
if (inter->hovering) color = style->textShadowHoverColor;
|
||||
if (inter->down) color = style->textShadowActiveColor;
|
||||
DrawTextEx(style->font, node->string, (Vector2){
|
||||
drawRect.x + style->shadowOffset[BZ_UI_AXIS_X],
|
||||
drawRect.y + style->shadowOffset[BZ_UI_AXIS_Y]
|
||||
}, style->fontSize, style->fontSpacing, color);
|
||||
}
|
||||
if (node->flags & BZ_UI_DRAW_TEXT) {
|
||||
Color color = style->textColor;
|
||||
if (inter->hovering) color = style->textHoverColor;
|
||||
if (inter->down) color = style->textActiveColor;
|
||||
DrawTextEx(GetFontDefault(), node->string, (Vector2){drawRect.x, drawRect.y}, style->fontSize, 1, color);
|
||||
DrawTextEx(style->font, node->string, (Vector2){drawRect.x, drawRect.y}, style->fontSize, style->fontSpacing, color);
|
||||
}
|
||||
|
||||
node->changed = false;
|
||||
|
||||
Reference in New Issue
Block a user