big refactor

This commit is contained in:
huaqo-games
2025-03-17 19:28:12 +01:00
parent 990cdc6e50
commit 2f4dc166ee
31 changed files with 6657 additions and 322 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef ANIMATION_H
#define ANIMATION_H
typedef struct {
int currentFrame;
int maxFrame;
int framesCounter;
int framesSpeed;
float animTimer;
} Animation;
void UpdateAnimation(Animation *animation, float deltaTime) {
animation->animTimer += deltaTime;
float frameTime = 1.0f / animation->framesSpeed;
if (animation->animTimer < frameTime) {
return;
}
animation->animTimer -= frameTime;
animation->currentFrame++;
if (animation->currentFrame >= animation->maxFrame) {
animation->currentFrame = 0;
}
}
#endif // ANIMATION_H