better build system and game over message more better

This commit is contained in:
Matthias Gatto 2015-09-28 21:35:35 +02:00
parent 60455f73d9
commit 307e6a27cb
3 changed files with 24 additions and 5 deletions

12
Makefile Normal file
View File

@ -0,0 +1,12 @@
NAME= "Curses Bird"
build: main.o
gcc -o ${NAME} main.o -lcurses
clean:
rm main.o
fclean: clean
${NAME}

View File

@ -1,3 +1,3 @@
#!/bin/sh
gcc -lcurses main.c
mv a.out cursesBird
gcc main.c -lcurses
mv a.out cursesBird

13
main.c
View File

@ -198,13 +198,20 @@ int checkCol(Map *map)
}
static int askToReplay()
{
char ret;
move(0,0);
int xPos = COLS / 2 - sizeof("You just lose the game with %d point, do you want to replay ?") / 2;
erase();
printw("You just lose the game with %d point, do you want to replay ?\n"
"Press Y if you want to try again, N if you don't", score);
move(0, xPos);
printw("You just lose the game with %d point, do you want to replay ?",
score);
xPos = COLS / 2 - sizeof("Press Y if you want to try again, N if you don't") / 2;
move(1, xPos);
printw("Press Y if you want to try again, N if you don't");
ret = waitForSomething("yYnN");
if (ret == 'y' || ret == 'Y')
return (1);