aboutsummaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-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