diff --git a/game/systems/s_event.c b/game/systems/s_event.c index b512196..2af7f49 100644 --- a/game/systems/s_event.c +++ b/game/systems/s_event.c @@ -27,6 +27,10 @@ void damageEvent(ecs_entity_t entity, DamageEvent event) { .elapsed = 0 }; snprintf(floatyText.text, sizeof(floatyText.text), "-%.1f", event.amount); + const Game *game = ecs_singleton_get(ECS, Game); + Vector2 textSize = MeasureTextEx(game->font, floatyText.text, floatyText.txtSize, 1.0f); + floatyText.pos.x -= textSize.x * 0.5f; + floatyText.pos.y -= textSize.y * 0.5f; ecs_entity_t floaty = entityCreateEmpty(); ecs_set_ptr(ECS, floaty, FloatyTextParticle, &floatyText);