summaryrefslogtreecommitdiff
path: root/sprite-animator.h
diff options
context:
space:
mode:
authorriton <riton@riton.home>2025-03-29 21:37:46 +0300
committerriton <riton@riton.home>2025-03-29 21:37:46 +0300
commit1b6ecc22e77b7aa1fee16420b041c1dea1925052 (patch)
tree6816b0d3ebcfa30492371233fcce253ef5275f31 /sprite-animator.h
init repoHEADmaster
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