boxes

Tracer des diagrammes dans un terminal - retour accueil

git clone git://bebou.netlib.re/boxes

Log | Files | Refs | README |

commit 3f4058b4beb6d2d7f572cb9d7f7559ad8863d628
parent ce7d5c67c59b090d049d214abae0c21980010b2f
Auteurice: Arthur Pons <arthur.pons@unistra.fr>
Date:   Fri, 13 Jun 2025 22:24:37 +0200

Positionnement des infos de debug

Diffstat:
Mboxes.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/boxes.c b/boxes.c @@ -24,7 +24,7 @@ void drawboxcoord(int x, int y, int w, int h) { tb_printf(x,y+i,TB_DEFAULT,TB_DEFAULT, "│"); tb_printf(x+w,y+i,TB_DEFAULT,TB_DEFAULT, "│"); } - tb_printf(30,0,TB_DEFAULT,TB_DEFAULT,"x: %d, y: %d\nw: %d, h: %d",x,y,w,h); + tb_printf(tb_width()/2,0,TB_DEFAULT,TB_DEFAULT,"x: %d, y: %d\nw: %d, h: %d",x,y,w,h); } void drawbox(struct box b) { drawboxcoord(b.x,b.y,b.w,b.h); } @@ -53,7 +53,7 @@ int main(int argc, char **argv) { while(1) { tb_clear(); for (int i=0;i<boxes.count;i++) drawbox(boxes.list[i]); - tb_printf(tb_height(),0,TB_DEFAULT,TB_DEFAULT,"count: %d",boxes.count); + tb_printf(tb_width()/2,tb_height()-1,TB_DEFAULT,TB_DEFAULT,"count: %d",boxes.count); tb_present(); tb_poll_event(&ev); switch(ev.key) {