#define TART_UTF8 #include "../includes/tart.h" #include #include #include #include #define jump tart_move_cursor int e = 1; void aOnExit() { //printf("shutting Down"); e = 0; } void draw_button(tart_window *w,const t_char* label, tart_vec2 position) { jump(w, (tart_vec2){position.x,position.y + 0}); tart_printf(w, 1, T"┏━━━"); int size = t_strlen(label); for(int i = 0; i < size; i++ ) { tart_printf(w, 1, T"━"); } tart_printf(w, 1, T"━━━┓"); jump(w, (tart_vec2){position.x,position.y + 1}); tart_printf(w, 1, T"┃ %ls ┃", label); jump(w, (tart_vec2){position.x,position.y + 2}); tart_printf(w, 1, T"┗━━━"); for(int i = 0; i < size; i++ ) { tart_printf(w, 1, T"━"); } tart_printf(w, 1, T"━━━┛"); } int main(int argc, char *argv[]) { signal(SIGINT, aOnExit); setlocale(LC_CTYPE, "en_US.UTF-8"); tart_window w; int color0 = 0; int color1 = 0; int color2 = 0; tart_create_window(&w, (tart_vec2){80,40}, "testing"); tart_init(&w); tart_disable_cusor(); w.pallet[0].background.r = 0; w.pallet[0].background.g = 0; w.pallet[0].background.b = 0; w.pallet[0].forground.r = 0; w.pallet[0].forground.g = 0; w.pallet[0].forground.b = 0; w.pallet[1].forground.r = 0xff; w.pallet[1].forground.g = 0x00; w.pallet[1].forground.b = 0xcc; w.pallet[2].forground.r = 0x3b; w.pallet[2].forground.g = 0x3b; w.pallet[2].forground.b = 0x3b; jump(&w, (tart_vec2){1,1}); jump(&w, (tart_vec2){1,2}); int x = 0; while(e != 0) { tart_draw(&w); draw_button(&w, T"This is really cool!", (tart_vec2){5,5}); tart_jump(&w, (tart_vec2){3,10}); tart_printf(&w,1, T"this is\na new line test\nyay"); tart_jump(&w, (tart_vec2){3+ 20,10}); tart_printf(&w,1, T"this is\na new line test\nyay"); tart_jump(&w, (tart_vec2){3,14}); tart_printf(&w,2, T"this is\na new line test\nyay"); if(w.pallet[1].forground.r == 254) { color0 = 0; } if(w.pallet[1].forground.r == 0) { color0 = 1; } if(w.pallet[1].forground.g == 254) { color1 = 0; } if(w.pallet[1].forground.g == 0) { color1 = 1; } if(w.pallet[1].forground.b == 254) { color2 = 0; } if(w.pallet[1].forground.b == 0) { color2 = 1; } if(color0 == 1) { w.pallet[1].forground.r++; }else { w.pallet[1].forground.r--; } if(color1 == 1) { w.pallet[1].forground.g++; }else { w.pallet[1].forground.g--; } if(color2 == 1) { w.pallet[1].forground.b++; }else { w.pallet[1].forground.b--; } } tart_close(&w); tart_enable_cusor(); //printf("\e[?1049l"); printf("done\n"); return 0; }