Files
mazemaker/include/mazemaker.h

59 lines
2.0 KiB
C

#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;
typedef struct {
size_t x, y;
} maze_point_t;
typedef struct {
size_t length;
maze_point_t* nodes;
} maze_path_t;
typedef struct mazeoptions mazeoptions_t;
void mazemaker_generate_maze(int width, int height, mazegrid_t* result);
void mazemaker_generate_maze_opt(int width, int height, mazegrid_t* result, mazeoptions_t const*);
void mazemaker_free_maze(mazegrid_t* maze);
int mazemaker_maze_to_png(mazegrid_t const* maze, char const* filename);
int mazemaker_maze_to_png_opt(mazegrid_t const* maze, char const* filename, mazeoptions_t const*);
int mazemaker_path_to_png(maze_path_t const* path, char const* filename);
int mazemaker_path_to_png_opt(maze_path_t const* path, char const* filename, mazeoptions_t const*);
int mazemaker_maze_to_png_mem(mazegrid_t const* maze, size_t* len, uint8_t** buf);
int mazemaker_maze_to_png_mem_opt(mazegrid_t const* maze, size_t* len, uint8_t** buf, mazeoptions_t const*);
int mazemaker_path_to_png_mem(maze_path_t const* maze, size_t* len, uint8_t** buf);
int mazemaker_path_to_png_mem_opt(maze_path_t const* maze, size_t* len, uint8_t** buf, mazeoptions_t const*);
mazeoptions_t* mazemaker_options_new();
void mazemaker_options_free(mazeoptions_t*);
int mazemaker_options_set_wall_color(mazeoptions_t*, char const* color_desc);
int mazemaker_options_set_background_color(mazeoptions_t*, char const* color_desc);
int mazemaker_options_set_path_color(mazeoptions_t*, char const* color_desc);
void mazemaker_options_set_seed(mazeoptions_t*, unsigned int seed);
int mazemaker_solve(mazegrid_t const* maze, maze_path_t* path);
void mazemaker_path_free(maze_path_t* path);
#endif // !def(_MAZEMAKER_H)