restore: whole project
This commit is contained in:
24
src/util/animation_util.c
Normal file
24
src/util/animation_util.c
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "animation_util.h"
|
||||
|
||||
Animation *MirrorAnimations(Animation *originalAnimations, int count)
|
||||
{
|
||||
if (!originalAnimations || count <= 0) return NULL;
|
||||
|
||||
Animation *mirrored = malloc(sizeof(Animation) * count);
|
||||
if (!mirrored) return NULL;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
mirrored[i] = originalAnimations[i];
|
||||
mirrored[i].currentFrame = 0;
|
||||
mirrored[i].elapsedTime = 0;
|
||||
|
||||
// mirror
|
||||
Image img = LoadImageFromTexture(originalAnimations[i].texture);
|
||||
ImageFlipHorizontal(&img);
|
||||
mirrored[i].texture = LoadTextureFromImage(img);
|
||||
UnloadImage(img);
|
||||
}
|
||||
|
||||
return mirrored;
|
||||
}
|
||||
Reference in New Issue
Block a user