Un outil pour réarranger les lignes de stdin - retour accueil
git clone git://bebou.netlib.re/reorder
Log | Files | Refs | README |
commit bb78ba3f03a8f7d2a9eca814259a1ef29b993b66 parent 831b3574e59ad885ee85cb9d2bf64b92326fb733 Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Fri, 17 Jan 2025 16:37:44 +0100 Les menus côte à côte Diffstat:
M | reorder.c | | | 13 | +++++++++---- |
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/reorder.c b/reorder.c @@ -16,6 +16,8 @@ struct pile int curline; }; +int max(int a, int b) { return a > b ? a : b; } + void addcardtopile(char* cardname, struct pile* p) { p->cards[p->cardCount] = malloc(CARD_NAME_SIZE); strcpy(p->cards[p->cardCount], cardname); @@ -57,6 +59,7 @@ struct pile file2pile(FILE *fp) { return pi; } + void display(struct pile* h, struct pile* p, int handcurline, int playedcurline, char* curmenu,bool selection) { tb_clear(); int i; int j; @@ -70,16 +73,18 @@ void display(struct pile* h, struct pile* p, int handcurline, int playedcurline, } else { tb_printf(0, i, TB_DEFAULT, TB_BLACK, h->cards[i]); } } - tb_printf(0, i, TB_DEFAULT, TB_BLACK, "------"); + for (int w=0;w<max(p->cardCount,h->cardCount);w++) { + tb_printf(10,w,TB_DEFAULT, TB_BLACK, "|"); + } for (j=0;j<p->cardCount;j++) { if (j==playedcurline && curmenu=="played") { if (selection) { - tb_printf(0, i+j+1, TB_BLACK, TB_BLUE, p->cards[j]); + tb_printf(10+2, j, TB_BLACK, TB_BLUE, p->cards[j]); } else { - tb_printf(0, i+j+1, TB_BLACK, TB_WHITE, p->cards[j]); + tb_printf(10+2, j, TB_BLACK, TB_WHITE, p->cards[j]); } } - else { tb_printf(0, i+j+1, TB_DEFAULT, TB_BLACK, p->cards[j]); } + else { tb_printf(10+2, j, TB_DEFAULT, TB_BLACK, p->cards[j]); } } tb_present(); }