From 57315da56fa3b036f8e3e2d32a5f90a11ae7c3de Mon Sep 17 00:00:00 2001 From: kartofen Date: Thu, 11 Aug 2022 16:41:00 +0300 Subject: works with images --- src/main.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index f291ee5..6bec32e 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,5 @@ #include #include -#include #include #include "typedef.h" #include "ppm.h" @@ -12,8 +11,8 @@ size_t TILES; size_t TILE_WIDTH; size_t TILE_HEIGHT; -size_t SWIDTH = 10; -size_t SHEIGHT = 10; +size_t SWIDTH = 30; +size_t SHEIGHT = 30; int get_least_entropy_index() { @@ -85,17 +84,14 @@ void collapse_this(int i) int main(void) { - calc_tiles(); - if(TILES > TILES_CAP) { - printf("ERROR: Too many tiles: %ld\n", TILES); - exit(EXIT_FAILURE); - } + load_tiles(); + print_tiles(); - time_t seed = 420; + time_t seed = 69; srand(seed); printf("The Seed is %ld\n", seed); - generate_tile_masks(load_tile_connections()); + generate_tile_masks(get_tile_connections()); init_tilemap(); while(1) { @@ -108,12 +104,9 @@ int main(void) collapse_this(lei); } - load_tiles(); - size_t img_wdt = TILE_WIDTH * SWIDTH; size_t img_hgt = TILE_HEIGHT * SHEIGHT; small_t *image = malloc(img_wdt * img_hgt * 3); - memset(image, 0, img_wdt * img_hgt); for(size_t i = 0; i < SHEIGHT; i++) { @@ -135,7 +128,7 @@ int main(void) char file_name[64] = {0}; sprintf(file_name, "files/file_%ld.ppm", seed); - save_as_ppm(file_name, image, img_wdt, img_hgt, 10); + save_as_ppm(file_name, image, img_wdt, img_hgt, 9); printf("Saved file with name: %s\n", file_name); free(image); -- cgit v1.2.3