#include #include "ppm.h" extern int *(tiles[]); extern int TILE_WIDTH; extern int TILE_HEIGHT; void load_tiles(int n) { int width, height; for(int i = 0; i < n; i++) { char file_path[26]; sprintf(file_path, "files/tile_%d.ppm", i); tiles[i] = load_from_ppm(file_path, &width, &height); } TILE_WIDTH = width; TILE_HEIGHT = height; } void free_tiles(int n) { for(int i = 0; i < n; i++) free_ppm(tiles[i]); } void print_tiles(int n) { for(int i = 0; i < n; i++) { for(int y = 0; y < TILE_HEIGHT; y++) { for(int x = 0; x < TILE_WIDTH; x++) putchar(tiles[i][y * TILE_WIDTH + x] + '0'); putchar('\n'); } putchar('\n'); } }