aboutsummaryrefslogtreecommitdiff
path: root/header.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-09-17 17:08:10 +0200
committerCharles <sircharlesaze@gmail.com>2019-09-17 17:08:10 +0200
commit95b209426dd7a9f844cf1aa093a2b1c4301f049b (patch)
treed52a30d085147646071b6d6fe96a1aae411339a4 /header.h
parent6f826d798eaaf01d2025de791985427faa0a6a6b (diff)
downloadmandelbrot-95b209426dd7a9f844cf1aa093a2b1c4301f049b.tar.gz
mandelbrot-95b209426dd7a9f844cf1aa093a2b1c4301f049b.tar.bz2
mandelbrot-95b209426dd7a9f844cf1aa093a2b1c4301f049b.zip
Options
A Config struct and more getopt options for window size, real/imag range, center position.
Diffstat (limited to 'header.h')
-rw-r--r--header.h20
1 files changed, 12 insertions, 8 deletions
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 <stdbool.h>
-# include <complex.h>
# include <SDL2/SDL.h>
-# 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);