diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-05-19 16:46:13 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-05-19 18:19:31 +0200 |
| commit | b0998910dd974280b3c6f3f65e21bfd5859b117f (patch) | |
| tree | 5a7049ac6cf0d05370df3324b2bb4b591c2bac87 /inc | |
| parent | 6a80b1b70ec069b051c0e31aafac6eb596e20261 (diff) | |
| download | mandelbrot-b0998910dd974280b3c6f3f65e21bfd5859b117f.tar.gz mandelbrot-b0998910dd974280b3c6f3f65e21bfd5859b117f.tar.bz2 mandelbrot-b0998910dd974280b3c6f3f65e21bfd5859b117f.zip | |
Basic explorer with window resize, iterations change, moving around
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/config.h | 3 | ||||
| -rw-r--r-- | inc/mandel.h | 20 |
2 files changed, 20 insertions, 3 deletions
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 <stdlib.h> # include <stdbool.h> # include <math.h> +# include <immintrin.h> # include <SDL2/SDL.h> #define SDL_CALL(x) do { \ @@ -25,6 +26,13 @@ typedef union typedef struct { + uint8_t h; + uint8_t s; + uint8_t l; +} ColorHSL; + +typedef struct +{ double x; double y; } Point; @@ -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 |
