aboutsummaryrefslogtreecommitdiff
path: root/header.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-08-28 13:57:11 +0200
committerCharles <sircharlesaze@gmail.com>2019-08-28 13:57:11 +0200
commitdf6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c (patch)
treeb27d14df93691892c8e906435b8c4ee9ac46b5bc /header.h
parentff61da6fb9720106d7869a0e5026810450d8f515 (diff)
downloadmandelbrot_cpu-df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c.tar.gz
mandelbrot_cpu-df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c.tar.bz2
mandelbrot_cpu-df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c.zip
Proportionnal movement and zoom
Zooming and moving is proportionnal to the range we are viewing, feels more natural than incrementing by a constant value.
Diffstat (limited to 'header.h')
-rw-r--r--header.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/header.h b/header.h
index 9799715..fba32c6 100644
--- a/header.h
+++ b/header.h
@@ -5,10 +5,10 @@
# include <complex.h>
# include <SDL2/SDL.h>
-# define REAL_LO -2.0
-# define REAL_HI 2.0
-# define IMAG_LO -2.0
-# define IMAG_HI 2.0
+# 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 ESCAPE_VALUE 2
@@ -19,15 +19,20 @@ typedef int Color;
typedef struct
{
+ double x;
+ double y;
+} Point;
+
+typedef struct
+{
SDL_Window *window;
SDL_Renderer *renderer;
bool running;
int window_w;
int window_h;
- double real_lo;
- double real_hi;
- double imag_lo;
- double imag_hi;
+ Point center;
+ double real_range;
+ double imag_range;
Color *palette;
} GState;