diff --git a/Makefile b/Makefile index 7c304ad..9a0b40b 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ $(shell mkdir -p build) all: - gcc main.c -o build/main -lraylib -lm + gcc -Wall -Wextra main.c -o build/main -lraylib -lm release: - gcc -O3 -DRELEASE main.c -o build/main -lraylib -m + gcc -Wall -Wextra -O3 -DRELEASE main.c -o build/main -lraylib -m run: all ./build/main diff --git a/data/player.aseprite b/data/player.aseprite new file mode 100644 index 0000000..05c9dcf Binary files /dev/null and b/data/player.aseprite differ diff --git a/data/player.png b/data/player.png new file mode 100644 index 0000000..cb4edd1 Binary files /dev/null and b/data/player.png differ diff --git a/main.c b/main.c index 87942d2..358bb7b 100644 --- a/main.c +++ b/main.c @@ -46,6 +46,7 @@ Rectangle trap = { .height = trap_len, }; +Texture player_t; Vec2i player; const int player_radius = 25; const int player_speed = 5; @@ -171,6 +172,8 @@ void move_map(Vector2 *map, Cardinal direction, const int speed, const float DT) map->y -= diag_step; map->x += diag_step; break; + default: + break; } } @@ -182,6 +185,7 @@ int main(void) SetTargetFPS(60); player = (Vec2i) {.x = screen.width/2, .y = screen.height/2}; + player_t = LoadTexture("data/player.png"); map = LoadTexture("data/map2.png"); map_coord = (Vector2){ screen.width/2 - map.width*map_factor/2, @@ -205,7 +209,13 @@ int main(void) } DrawTextureEx(map, map_coord, 0.0f, map_factor, WHITE); - DrawCircle(player.x, player.y, player_radius, BLUE); + DrawTexture( + player_t, + player.x-player_t.width/2, + player.y-player_t.height/2, + WHITE + ); + // DrawRectangleLinesEx(trap, 1, RED); } EndDrawing();