summaryrefslogtreecommitdiff
path: root/Week1-Pacman/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'Week1-Pacman/src/main.c')
-rw-r--r--Week1-Pacman/src/main.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/Week1-Pacman/src/main.c b/Week1-Pacman/src/main.c
index e4113be..373d795 100644
--- a/Week1-Pacman/src/main.c
+++ b/Week1-Pacman/src/main.c
@@ -3,6 +3,7 @@
#include <stdbool.h>
#include "demo.h"
#include "pacman.h"
+#include "map.h"
#define WINDOW_WIDTH 800
#define WINDOW_HEIGHT 600
@@ -25,10 +26,16 @@ int main() {
SDL_Event e;
struct pacman pacman = {0};
+
+ map_init(&demo);
+
+ struct map map = {0};
+ load_map("assets/Maps/maze.csv", &map);
+
for(int i = 0; i < 4; i++)
init_animation(&pacman.animations[i], &(struct animation_init){
.ren = demo.ren,
- .spritesheet = "assets/sprites.png",
+ .spritesheet = "assets/Sprites/sprites.png",
.initial_angle = 90.0 * i,
.initial_frame_count = 3,
@@ -36,21 +43,21 @@ int main() {
.initial_frames = (SDL_Rect[]) {
{
.x = 0,
- .y = 190,
- .w = 120,
- .h = 130
+ .y = 285,
+ .w = 180,
+ .h = 195
},
{
- .x = 160,
- .y = 190,
- .w = 120,
- .h = 130
+ .x = 240,
+ .y = 285,
+ .w = 180,
+ .h = 195
},
{
- .x = 310,
- .y = 190,
- .w = 130,
- .h = 130
+ .x = 465,
+ .y = 285,
+ .w = 195,
+ .h = 195
}
}
});
@@ -74,6 +81,7 @@ int main() {
SDL_RenderClear(demo.ren);
update_pacman(&pacman, dt);
update_demo(&demo);
+ draw_map(&demo, &map);
draw_pacman(&demo, &pacman);
SDL_RenderPresent(demo.ren);
}