Add animations back
This commit is contained in:
@@ -288,25 +288,26 @@ void entityUpdateAnimationState(ecs_iter_t *it) {
|
||||
}
|
||||
}
|
||||
void entityUpdateAnimation(ecs_iter_t *it) {
|
||||
/*
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
Animation *anim = ecs_field(it, Animation, 1);
|
||||
TextureRegion *t = ecs_field(it, TextureRegion, 2);
|
||||
Game *game = ecs_singleton_get_mut(ECS, Game);
|
||||
Animation *anim = ecs_field(it, Animation, 1);
|
||||
TextureRegion *texture = ecs_field(it, TextureRegion, 2);
|
||||
|
||||
float dt = GetFrameTime();
|
||||
|
||||
for (i32 i = 0; i < it->count; i++) {
|
||||
anim[i].frameDuration = game->frameDuration;
|
||||
AnimationFrame frame = anim[i].frame;
|
||||
AnimationSequence seq = anim[i].sequence;
|
||||
|
||||
anim[i].elapsed += dt;
|
||||
if (anim[i].elapsed < anim[i].frameDuration) continue;
|
||||
if (anim[i].elapsed < frame.duration) continue;
|
||||
|
||||
anim[i].curFrame = (anim[i].curFrame + 1) % anim[i].sequence.frameCount;
|
||||
i32 nextFrame = (anim[i].curFrame + 1) % seq.frameCount;
|
||||
anim[i].curFrame = nextFrame;
|
||||
anim[i].frame = entityGetAnimationFrame(anim[i].entityType, anim[i].animType, nextFrame);
|
||||
anim[i].elapsed = 0.0f;
|
||||
|
||||
BzTile tile = anim[i].sequence.startFrame + anim[i].curFrame + anim[i].tileset->startID;
|
||||
t[i].rec = bzTilesetGetTileRegion(anim[i].tileset, tile);
|
||||
anim[i].elapsed = 0.0f;
|
||||
texture[i].rec = bzTilesetGetTileRegion(anim[i].tileset, anim[i].frame.frame);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
static void render(ecs_iter_t *it) {
|
||||
|
||||
Reference in New Issue
Block a user