This function is used to create a component.
dg_component_t *dg_component_create(char *name, void *data, dg_cpt_destroy_t cff);
dg_component_t *component = dg_component_create("score", score,
&component_destroy);
dg_component_t *dg_component_create(char *name, void *data,
dg_cpt_destroy_t cff)
{
dg_component_t *component = malloc(sizeof(dg_component_t));
if (!component)
return 0;
component->name = name;
component->data = data;
component->on_destroy = cff;
return component;
}