22 lines
649 B
C
22 lines
649 B
C
#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;
|
|
} |