summaryrefslogtreecommitdiff
path: root/Week1-Pacman/src/pacman.h
blob: 65137cd38f259571ab433e473486796432f2e778 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef PACMAN_H_
#define PACMAN_H_

#include <SDL2/SDL.h>
#include "animation.h"
#include "demo.h"
#include "map.h"

enum facing {
  FACING_RIGHT,
  FACING_DOWN,
  FACING_LEFT,
  FACING_UP
};

struct pacman_init {
  float initial_xpos;
  float initial_ypos;
  enum facing initial_facing;
};

struct pacman {
  /*
   * Coolest bug I have ever seen in my life
 */
  float xpos;
  float ypos;

  enum facing facing;

  /* One for each face */
  struct animation animations[4];
};

void load_pacman_spritesheet(struct demo* demo);
void init_pacman(struct pacman* pacman, struct pacman_init* init);
void handle_pacman_input(struct pacman* pacman, struct map* map);
void update_pacman(struct pacman* pacman, float dt, struct map* map);
void draw_pacman(struct demo* demo, const struct pacman* pacman);

#endif // PACMAN_H_