summaryrefslogtreecommitdiff
path: root/sprite-animator.h
diff options
context:
space:
mode:
Diffstat (limited to 'sprite-animator.h')
-rw-r--r--sprite-animator.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/sprite-animator.h b/sprite-animator.h
new file mode 100644
index 0000000..ab61dd7
--- /dev/null
+++ b/sprite-animator.h
@@ -0,0 +1,27 @@
+#ifndef SPRITE_SHEET_ANIMATOR_H
+#define SPRITE_SHEET_ANIMATOR_H
+
+#include <raylib.h>
+#include "def.h"
+
+typedef struct AnimationPlayer {
+ Texture2D *sheet;
+ int frame_counter;
+ int frame_speed;
+ int frame_current;
+ Rectangle frame_rec;
+ float frame_width;
+ float frame_height;
+
+ int index_start;
+ int index_offset;
+ int index_end;
+ int index_increment;
+} animation_player_t;
+
+animation_player_t make_animation_player(Texture2D *texture, int row, int col, int start, int end, int inc, int offset);
+void update_frame(animation_player_t *anim);
+void draw_frame(animation_player_t *anim, Vector2 pos, Color tint);
+void draw_frame_box(animation_player_t *anim, Vector2 pos);
+
+#endif