blob: e6f3e10c519ccd22cc3eb1c87893c037bc217af8 (
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
47
48
49
50
51
52
53
54
55
|
#ifndef MANDEL_H
# define MANDEL_H
# include <stdlib.h>
# include <stdbool.h>
# include <math.h>
# include <SDL2/SDL.h>
#define SDL_CALL(x) do { \
SDL_ClearError(); \
x; \
error_check_sdl(#x, __FILE__, __LINE__); \
} while (0)
typedef union
{
uint32_t data;
struct
{
uint8_t b;
uint8_t g;
uint8_t r;
};
} Color;
typedef struct
{
double x;
double y;
} Point;
typedef struct
{
SDL_Window *window;
SDL_Renderer *renderer;
bool running;
SDL_Surface *surface;
Color *palette;
} State;
// mandelbrot.c
int mandelbrot(double a, double b);
// state.c
bool state_init(State *state);
void state_quit(State *state);
void state_run(State *state);
// event.c
void event_handle(State *state);
// error.c
void error_check_sdl(const char *code, const char *filename, int line_num);
#endif
|