From b0998910dd974280b3c6f3f65e21bfd5859b117f Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 19 May 2020 16:46:13 +0200 Subject: Basic explorer with window resize, iterations change, moving around --- inc/config.h | 3 ++- inc/mandel.h | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/config.h b/inc/config.h index 4085dba..4ce9f2e 100644 --- a/inc/config.h +++ b/inc/config.h @@ -3,7 +3,8 @@ # define MANDEL_WINDOW_WIDTH 640 # define MANDEL_WINDOW_HEIGHT 480 - # define MANDEL_WINDOW_TITLE "Mandelbrot" +# define MANDEL_SURFACE_DEPTH 8 +# define MANDEL_ITERATIONS 20 #endif diff --git a/inc/mandel.h b/inc/mandel.h index e6f3e10..a98e007 100644 --- a/inc/mandel.h +++ b/inc/mandel.h @@ -4,6 +4,7 @@ # include # include # include +# include # include #define SDL_CALL(x) do { \ @@ -23,6 +24,13 @@ typedef union }; } Color; +typedef struct +{ + uint8_t h; + uint8_t s; + uint8_t l; +} ColorHSL; + typedef struct { double x; @@ -34,12 +42,17 @@ typedef struct SDL_Window *window; SDL_Renderer *renderer; bool running; - SDL_Surface *surface; + SDL_Texture *texture; Color *palette; + double real_start; + double real_end; + double imag_start; + double imag_end; + int iterations; } State; // mandelbrot.c -int mandelbrot(double a, double b); +int mandelbrot(double ca, double cb, int iterations); // state.c bool state_init(State *state); @@ -52,4 +65,7 @@ void event_handle(State *state); // error.c void error_check_sdl(const char *code, const char *filename, int line_num); +// color.c +Color *color_palette_new(Color *palette, int iterations); + #endif -- cgit