Set debug printing function for sprites initialized with CGs

This commit is contained in:
kichikuou
2023-03-27 20:13:27 +09:00
parent a923b0ce23
commit 45ebaa2c7f
+7 -5
View File
@@ -175,6 +175,11 @@ struct texture *sprite_get_texture(struct sact_sprite *sp)
return &sp->texture;
}
static void _sprite_print(struct sprite *sp)
{
sprite_print((struct sact_sprite*)sp);
}
void sprite_set_cg(struct sact_sprite *sp, struct cg *cg)
{
gfx_delete_texture(&sp->texture);
@@ -184,6 +189,7 @@ void sprite_set_cg(struct sact_sprite *sp, struct cg *cg)
sp->sp.has_pixel = true;
sp->sp.has_alpha = cg->metrics.has_alpha;
sp->sp.render = sprite_render;
sp->sp.debug_print = _sprite_print;
sprite_dirty(sp);
}
@@ -212,6 +218,7 @@ void sprite_set_cg_2x(struct sact_sprite *sp, struct cg *cg)
sp->sp.has_pixel = true;
sp->sp.has_alpha = cg->metrics.has_alpha;
sp->sp.render = sprite_render;
sp->sp.debug_print = _sprite_print;
sprite_dirty(sp);
gfx_delete_texture(&tmp);
}
@@ -263,11 +270,6 @@ int sprite_save_cg(struct sact_sprite *sp, const char *path)
return gfx_save_texture(sprite_get_texture(sp), path, ALCG_QNT);
}
static void _sprite_print(struct sprite *sp)
{
sprite_print((struct sact_sprite*)sp);
}
/*
* Attach pixel data to a sprite. The texture is initialized lazily.
*/