This function is used to create a sprite component.
dg_component_t *dg_cpt_sprite(sfVector2f *scale);
dg_entity_add_component(player, dg_cpt_sprite(&scale));
static void component_destroy(void *data)
{
sfSprite *sprite = (sfSprite *)(data);
sfSprite_destroy(sprite);
}
dg_component_t *dg_cpt_sprite(sfVector2f *scale)
{
dg_cpt_destroy_t destroy = &component_destroy;
sfSprite *sprite = sfSprite_create();
dg_component_t *component = dg_component_create("sprite", sprite, destroy);
if (scale)
sfSprite_setScale(sprite, *scale);
return component;
}