From df6e7cbaa0edf2df8b5f3929a2eb34fa2aa5a28c Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 28 Aug 2019 13:57:11 +0200 Subject: Proportionnal movement and zoom Zooming and moving is proportionnal to the range we are viewing, feels more natural than incrementing by a constant value. --- header.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'header.h') diff --git a/header.h b/header.h index 9799715..fba32c6 100644 --- a/header.h +++ b/header.h @@ -5,10 +5,10 @@ # include # include -# 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 @@ -17,6 +17,12 @@ typedef int Color; +typedef struct +{ + double x; + double y; +} Point; + typedef struct { SDL_Window *window; @@ -24,10 +30,9 @@ typedef struct 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; -- cgit