1 #ifndef __DRAW_H__ 2 #define __DRAW_H__ 3 4 #include <SDL2/SDL.h> 5 #include <SDL2/SDL_ttf.h> 6 7 #include "sav.h" 8 #include "util.h" 9 #include "sdl_extra.h" 10 #include "sort.h" 11 12 #define SEL_COLOR 0x00FF0000 /* RGBA (A not used rn) */ 13 #define CMP_COLOR 0x00FFFF00 14 #define NORM_COLOR 0xFF000000 15 16 #define FONT_SIZE 12 17 #define FONT_NAME "VictorMono-Regular.ttf" 18 #define FONT_COLOR 0xBBBBBB 19 20 #define BAR_HEIGHT 15 21 #define BAR_BORDER 2 22 23 #define WIN_MIN_W 800 24 #define WIN_MIN_H 600 25 26 #define X_BORDER 40 27 #define Y_BORDER 40 28 #define TOP_BORDER 150 29 #define RECT_WIDTH 5 30 31 typedef struct { 32 SDL_Renderer *rend; 33 SDL_Window *win; 34 SDL_Rect bar_rect, bar_text_rect; 35 TTF_Font *font; 36 int w, h, bar_text_len; 37 size_t x_border, y_border; 38 char *bar_text; 39 } Drw; 40 41 status_t drw_create(Drw **drw); 42 void drw_destroy(Drw *drw); 43 44 void drw_element(SDL_Renderer *rend, int x, int y, int h); 45 void drw_element_color(Drw *drw, int x, int y, int h, unsigned int col); 46 status_t drw_update_frame(Drw *, SAV *); 47 48 void drw_array_graph(Drw *drw, SAV *sav); 49 status_t drw_status_bar(Drw *drw, SAV *sav); 50 51 #endif