summaryrefslogtreecommitdiff
path: root/Week1-Pacman/src/pacman.h
diff options
context:
space:
mode:
Diffstat (limited to 'Week1-Pacman/src/pacman.h')
-rw-r--r--Week1-Pacman/src/pacman.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/Week1-Pacman/src/pacman.h b/Week1-Pacman/src/pacman.h
new file mode 100644
index 0000000..567fc1d
--- /dev/null
+++ b/Week1-Pacman/src/pacman.h
@@ -0,0 +1,30 @@
+#ifndef PACMAN_H_
+#define PACMAN_H_
+
+#include <SDL2/SDL.h>
+#include "animation.h"
+
+enum facing {
+ FACING_UP,
+ FACING_DOWN,
+ FACING_LEFT,
+ FACING_RIGHT
+};
+
+struct pacman {
+ int xpos;
+ int ypos;
+
+ SDL_Texture* pacman_texture;
+ enum facing facing;
+ float frame_time;
+
+ /* One for each face */
+ struct animation animations[4];
+};
+
+void handle_pacman_input(SDL_Event* e, struct pacman* pacman);
+void update_pacman(struct pacman* pacman, float dt);
+void draw_pacman(SDL_Renderer* ren, const struct pacman* pacman);
+
+#endif // PACMAN_H_