/* * Copyright (C) 2024 dwlr * * BSD 3-Clause License (BSD-3-Clause) * See LICENSE for details */ #define ESC "\x1B" #define CSI ESC"[" void cli_draw_tex(texture* tex, bool bw) { ssize x, y; for(y = 0; y < tex->height; y++) { for(x = 0; x < tex->width; x++) { rgba* p = tex->texels + (x + tex->width * y); if(p->A == 0) printf(CSI"0m "); else { if(bw) printf("##"); else printf(CSI"48;2;%d;%d;%dm ", p->R, p->G, p->B); } } printf(CSI"0m\n"); } }