aboutsummaryrefslogtreecommitdiff
path: root/inc/mandel.h
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-05-22 10:44:49 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-22 10:44:49 +0200
commit6d4c3864e3b742a92e9874f1e4dfe3a9c1565188 (patch)
treea406e7f7d6bdc5210b2133762e39f7bdb396cfff /inc/mandel.h
parentc9098d549d63b5fe18d8c95049ba13a5ae6e9eca (diff)
downloadmandelbrot_cpu-6d4c3864e3b742a92e9874f1e4dfe3a9c1565188.tar.gz
mandelbrot_cpu-6d4c3864e3b742a92e9874f1e4dfe3a9c1565188.tar.bz2
mandelbrot_cpu-6d4c3864e3b742a92e9874f1e4dfe3a9c1565188.zip
Added information (iterations, center, time)
Diffstat (limited to 'inc/mandel.h')
-rw-r--r--inc/mandel.h26
1 files changed, 24 insertions, 2 deletions
diff --git a/inc/mandel.h b/inc/mandel.h
index 1496aa0..80cb5f4 100644
--- a/inc/mandel.h
+++ b/inc/mandel.h
@@ -6,13 +6,16 @@
# include <math.h>
# include <immintrin.h>
# include <SDL2/SDL.h>
+# include <SDL2/SDL_ttf.h>
-#define SDL_CALL(x) do { \
+# define SDL_CALL(x) do { \
SDL_ClearError(); \
x; \
error_check_sdl(#x, __FILE__, __LINE__); \
} while (0)
+# define TTF_CALL SDL_CALL
+
enum
{
KEY_UP = 0,
@@ -56,8 +59,16 @@ typedef struct
SDL_Window *window;
SDL_Renderer *renderer;
bool running;
- SDL_Texture *texture;
+
+ TTF_Font *font;
+ SDL_Texture *texture_center;
+ SDL_Texture *texture_iterations;
+ SDL_Texture *texture_time;
+ bool info;
+
Color *palette;
+ SDL_Texture *texture;
+
double real_start;
double real_end;
double imag_start;
@@ -82,4 +93,15 @@ void error_check_sdl(const char *code, const char *filename, int line_num);
// color.c
Color *color_palette_new(Color *palette, int iterations);
+// text.c
+# define TEXT_TEXTURE_UPDATE(state, texture, fmt, ...) do { \
+ if (state->info) { \
+ SDL_DestroyTexture(texture); \
+ texture = text_texture_new(state, fmt, __VA_ARGS__); \
+ } \
+} while(0)
+
+SDL_Texture *text_texture_new(State *state, const char *fmt, ...);
+void text_render(State *state, SDL_Texture *texture, int x, int y, int w, int h);
+
#endif