Reorganize code into library for reuse

This commit is contained in:
2021-05-08 15:58:59 -04:00
parent d1f144aca7
commit aa4d8efdd2
20 changed files with 140 additions and 75 deletions

29
include/mazemaker.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef _MAZEMAKER_H
#define _MAZEMAKER_H 1
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t edgeweight_t;
typedef struct {
edgeweight_t up, right;
} mazeedges_t;
typedef struct {
size_t width, height;
mazeedges_t** grid;
} mazegrid_t;
typedef enum {
EDGE_UP,
EDGE_RIGHT,
EDGE_DOWN,
EDGE_LEFT
} mazeedge_dir_t;
void mazemaker_generate_maze(int width, int height, mazegrid_t* result);
void mazemaker_free_maze(mazegrid_t* maze);
int mazemaker_maze_to_png(mazegrid_t const* maze, char const* filename);
#endif // !def(_MAZEMAKER_H)