aboutsummaryrefslogtreecommitdiffstats
path: root/src/animation.c
diff options
context:
space:
mode:
authornathansmith117 <thenathansmithsmith@gmail.com>2024-02-15 00:06:35 +0000
committernathansmith117 <thenathansmithsmith@gmail.com>2024-02-15 00:06:35 +0000
commit64bb931e18825b285dd93d0b9987ef72ece15ab4 (patch)
tree78cee060cf5f4f2bcc99254c99cead6f2d77578e /src/animation.c
parentadf3b7635326af20e0e77d37c080ef08c64e9e91 (diff)
downloadPenguinYippies-64bb931e18825b285dd93d0b9987ef72ece15ab4.tar.gz
PenguinYippies-64bb931e18825b285dd93d0b9987ef72ece15ab4.tar.bz2
PenguinYippies-64bb931e18825b285dd93d0b9987ef72ece15ab4.zip
Working on animation stuff
Diffstat (limited to 'src/animation.c')
-rw-r--r--src/animation.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/animation.c b/src/animation.c
new file mode 100644
index 0000000..f173401
--- /dev/null
+++ b/src/animation.c
@@ -0,0 +1,25 @@
+#include "animation.h"
+#include "game.h"
+#include <raylib.h>
+
+Animation loadAnimationFromFile(const char* fileName)
+{
+ Animation animation;
+
+ // Load image in.
+ animation.image = LoadImageAnim(fileName, &animation.frameCount);
+ animation.texture = LoadTextureFromImage(animation.image);
+
+ // Set options.
+ animation.currentFrame = 0;
+ animation.delay = ANIMATION_DEFAULT_DELAY;
+ animation.lastTime = -1.0; // -1.0 means there wasn't a last time.
+
+ return animation;
+}
+
+void freeAnimation(Animation* animation)
+{
+ UnloadImage(animation->image);
+ UnloadTexture(animation->texture);
+}