aboutsummaryrefslogtreecommitdiff
path: root/header.h
blob: 9799715ed899085d43774aeb407461368329a0de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef HEADER_H
# define HEADER_H

# include <stdbool.h>
# 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 MAX_ITERATION 35
# define ESCAPE_VALUE 2

/* typedef long double LDouble; */

typedef int Color;

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;
    Color *palette;
} GState;

// mandelbrot.c
int mandelbrot_in_set(double _Complex c);
void mandelbrot_print(void);

// graphics.c
GState *graphics_init(void);
void graphics_quit(GState *state);
void graphics_run(GState *state);

// helper.c
double map_range(double x, double src_lo, double src_hi, double dest_lo, double dest_hi);

#endif