Inspection for Animation component

This commit is contained in:
2024-01-10 16:59:17 +01:00
parent d730d7554b
commit 52cccf4665
5 changed files with 107 additions and 41 deletions

View File

@@ -166,11 +166,35 @@ void igTextureRegion(ecs_world_t *ecs,
tex->flipY = flipY;
}
static void igEntityType(EntityType *type) {
const char *prettyStrings[ENTITY_COUNT];
for (int i = 0; i < ENTITY_COUNT; i++) {
prettyStrings[i] = getEntityStr(i);
}
igCombo_Str_arr("EntityType", type, prettyStrings, ENTITY_COUNT, -1);
}
static void igAnimType(AnimType *type) {
const char *prettyStrings[ANIM_COUNT];
for (int i = 0; i < ANIM_COUNT; i++) {
prettyStrings[i] = getEntityAnimationStr(i);
}
igCombo_Str_arr("AnimType", type, prettyStrings, ANIM_COUNT, -1);
}
void igAnimation(ecs_world_t *ecs,
ecs_entity_t entity, ecs_entity_t comp) {
//Animation *anim = ecs_get_mut_id(ecs, entity, comp);
Animation *anim = ecs_get_mut_id(ecs, entity, comp);
EntityType curEntityType = anim->entityType;
igEntityType(&curEntityType);
anim->entityType = curEntityType;
AnimType curAnimType = anim->animType;
igAnimType(&curAnimType);
anim->animType = curAnimType;
igText("tileset: %p", anim->tileset);
igText("curFrame: %d", anim->curFrame);
igText("elapsed: %.2f < %.2F", anim->elapsed, anim->frame.duration);
}
void igEasing(ecs_world_t *ecs,
ecs_entity_t entity, ecs_entity_t comp) {