#include #include #include #include #include "framebuffer.h" int main(void) { setlocale(LC_ALL,""); term_init(); //fprintf(stderr, "%zux%zu\n", term_width, term_height); Framebuffer fb = fb_new(term_width, term_height); fb_fill(fb, P_RED); char c; const float k_x = 0.1; const float k_t = 0.1; size_t t = 0; long text_x = 0, text_y = 0; while(1) { fb_fill(fb, P_RED); /* Sine wave */ for (size_t x = 0; x < term_width; x++) { size_t y = ((sin(k_x * x + k_t * t) + 1.0) / 2 * term_height / 2) + (size_t)(term_height / 4); fb_vert_line(fb, x, y, term_height - 1, P_GREEN); } fb_text_no_bg(fb, text_x, text_y, "testing", C_BLACK); fb_print(fb); /* Handle input */ if (get_input(c) != 0) { switch(c) { case 'q': goto quit; break; case 'h': text_x -= 1; break; case 'l': text_x += 1; break; case 'k': text_y -= 1; break; case 'j': text_y += 1; break; } }; t++; } quit: fb_free(&fb); term_cleanup(); }