Un jeu de cartes à piper les une dans les autres - retour accueil
git clone git://bebou.netlib.re/pipe-game
Log | Files | Refs | README |
commit 0c7372d8db1c6aab7e7dd093ed176ae08315c3fe parent b834be01bd0075cc98ef495ec8d02a70738c65fc Auteurice: Arthur Pons <arthur.pons@unistra.fr> Date: Thu, 23 Jan 2025 17:48:19 +0100 Mini tuto dans le jeu Ca va être trop bas pour mon bsd mais bon Diffstat:
M | interface.c | | | 25 | +++++++++++++++---------- |
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/interface.c b/interface.c @@ -172,18 +172,18 @@ int displaytextblock(char *text, int rowoffset, int lineoffset) { return nbl+1; } -void debug(pile curmenu,struct tb_event ev) { - tb_printf(0,20,TB_DEFAULT,TB_DEFAULT,curmenu.name); +void debug(int l, pile curmenu,struct tb_event ev) { + tb_printf(0,l++,TB_DEFAULT,TB_DEFAULT,curmenu.name); char str[100];sprintf(str,"%d",curmenu.cardCount); - tb_printf(0,21,TB_DEFAULT,TB_DEFAULT,str); + tb_printf(0,l++,TB_DEFAULT,TB_DEFAULT,str); char str2[100]; sprintf(str2,"%d",curmenu.curline); - tb_printf(0,22,TB_DEFAULT,TB_DEFAULT,str2); - tb_printf(0,23,TB_DEFAULT,TB_DEFAULT,"touche %d, char %d, x %d, y %d\n",ev.key,ev.ch,ev.x,ev.y); - tb_printf(0,24,TB_DEFAULT,TB_DEFAULT,"type %d",ev.type); + tb_printf(0,l++,TB_DEFAULT,TB_DEFAULT,str2); + tb_printf(0,l++,TB_DEFAULT,TB_DEFAULT,"touche %d, char %d, x %d, y %d\n",ev.key,ev.ch,ev.x,ev.y); + tb_printf(0,l++,TB_DEFAULT,TB_DEFAULT,"type %d",ev.type); } -void display(pile** piles, pile curmenu, bool selection, char* cmd, char* res, char* intern) { +int display(pile** piles, pile curmenu, bool selection, char* cmd, char* res, char* intern) { int lineoffset=0; tb_clear(); @@ -201,8 +201,13 @@ void display(pile** piles, pile curmenu, bool selection, char* cmd, char* res, c lineoffset=displaytextblock(res,0,lineoffset); lineoffset=displaytextblock(intern,0,lineoffset); lineoffset=displaytextblock(cmd,0,lineoffset); + lineoffset=displaytextblock("\ + * enter to select card\n\ + * arrows to move selection\n\ + * m to create arg (if no whitespace)\n\ + * e to end turn and output res\n",0,lineoffset+2); - return; + return lineoffset; } @@ -236,8 +241,8 @@ int main(int argc, char **argv) { updatecmd(cmd, piles); updateres(res, cmd, fp2); updateinterncmd(intern, played); - display(piles,*curmenu,selection,cmd,res,intern); - debug(*curmenu,ev); + int l=display(piles,*curmenu,selection,cmd,res,intern); + debug(l,*curmenu,ev); tb_present(); tb_poll_event(&ev); switch(ev.type) {