From 95b209426dd7a9f844cf1aa093a2b1c4301f049b Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 17 Sep 2019 17:08:10 +0200 Subject: Options A Config struct and more getopt options for window size, real/imag range, center position. --- header.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'header.h') diff --git a/header.h b/header.h index 741919e..216db2d 100644 --- a/header.h +++ b/header.h @@ -2,15 +2,9 @@ # define HEADER_H # include -# include # include -# define CENTER_X 0.0 -# define CENTER_Y 0.0 -# define REAL_RANGE 4.0 -# define IMAG_RANGE 4.0 - -# define MAX_ITERATION 35 +# define MAX_ITERATION 200 # define ESCAPE_RADIUS 2 # define ESCAPE_RADIUS_SQUARED (ESCAPE_RADIUS * ESCAPE_RADIUS) @@ -49,6 +43,16 @@ typedef struct bool moving; } GState; +typedef struct +{ + int window_w; + int window_h; + double real_range; + double imag_range; + double center_x; + double center_y; +} Config; + // mandelbrot.c int mandelbrot_in_set(double a, double b); void mandelbrot_print(void); @@ -56,7 +60,7 @@ int *mandelbrot_array(Point center, double real_range, double imag_range, double real_len, double imag_len); // graphics.c -GState *graphics_init(void); +GState *graphics_init(Config *config); void graphics_quit(GState *state); void graphics_run(GState *state); Color *create_palette(Color start, Color end); -- cgit