summaryrefslogtreecommitdiff
path: root/Week1-Pacman/src/animation.h
diff options
context:
space:
mode:
authorBoredGuy <osome3717@gmail.com>2024-12-13 16:22:39 +0300
committerBoredGuy <osome3717@gmail.com>2024-12-13 16:22:39 +0300
commitebc3c130ed4d8ee6c44fc902bc4ee955799d1ac5 (patch)
treefd42ad5e77178f3aa7dc533ed0dde475cff3818a /Week1-Pacman/src/animation.h
Initial Commit
Diffstat (limited to 'Week1-Pacman/src/animation.h')
-rw-r--r--Week1-Pacman/src/animation.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/Week1-Pacman/src/animation.h b/Week1-Pacman/src/animation.h
new file mode 100644
index 0000000..795b6c7
--- /dev/null
+++ b/Week1-Pacman/src/animation.h
@@ -0,0 +1,29 @@
+#ifndef ANIMATION_H_
+#define ANIMATION_H_
+
+#include <SDL2/SDL_rect.h>
+#include <stdbool.h>
+
+struct animation_init {
+ int initial_frame_count;
+
+ float* initial_frame_times;
+ SDL_Rect* initial_frames;
+};
+
+struct animation {
+ int num_frames;
+
+ int current_frame;
+ float current_time;
+
+ float* frame_times;
+ SDL_Rect* frames;
+};
+
+void init_animation(struct animation* animation,
+ struct animation_init* init);
+void update_animation(struct animation* animation, float dt);
+void free_animation(struct animation* animation);
+
+#endif // ANIMATION_H_