Adding Sprite Animation (untested {no sprite sheet}) [running]

This commit is contained in:
n0ffie 2025-02-07 00:03:37 +01:00
parent 23a40216de
commit b7ddc3f292
6 changed files with 160 additions and 33 deletions

View file

@ -0,0 +1,38 @@
#ifndef ANIMATION_SPRITE_H
#define ANIMATION_SPRITE_H
#include <raylib.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
Texture2D texture;
Vector2 dimentions;
Rectangle sourceRect;
Vector2 size;
float rotation;
float scale;
int frameCount;
int currentFrame;
float speed;
float time;
} sprite_animation_t, *SpriteAnimation;
SpriteAnimation CreateSpriteAnimation(Texture2D texture, Vector2 sprite_texture_dimentions, Vector2 sprite_size, float rotation, float scale, int frameCount);
void UpdateSpriteAnimation(SpriteAnimation spriteAnimation, float dt);
void DrawSpriteAnimation(SpriteAnimation spriteAnimation, Vector2 position);
void DestroySpriteAnimation(SpriteAnimation spriteAnimation);
#ifdef __cplusplus
}
#endif
#endif // ANIMATION_SPRITE_H