From 2bd2316bf0bed35b4d89fa21a933e3d2c594c0a8 Mon Sep 17 00:00:00 2001 From: Matthew Mondor Date: Mon, 10 Apr 2023 21:19:20 +0000 Subject: [PATCH] Disable leaveok() and adjust messages to properly position cursor. --- src/main.cpp | 15 ++++++++------- src/mishaps.cpp | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 6af4b5b..264d193 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -588,9 +588,10 @@ int main(int argc, char *argv[]){ int smartbombs = 2; int drawlaser = 0; - cbreak(); - noecho(); - nonl(); + (void)cbreak(); + (void)noecho(); + (void)nonl(); + (void)leaveok(win, FALSE); (void)keypad(win, TRUE); (void)intrflush(stdscr, FALSE); (void)curs_set(0); @@ -1074,7 +1075,7 @@ int main(int argc, char *argv[]){ if(input=='q'){ char quit; clear(); - printw("Really quit (y/n)? "); + printw("Really quit (y/n) ? "); refresh(); for (quit = ERR; quit != 'y' && quit != 'n'; quit = block_getch()) ; if(quit=='y'){ @@ -1163,7 +1164,7 @@ int main(int argc, char *argv[]){ pause_game = 0; while(pause_game!=' '){ display_controls(); - mvprintw(10,25,"Paused. Press SPACE to continue.\n"); + mvprintw(10,25,"Paused. Press SPACE to continue. "); refresh(); pause_game = block_getch(); }; @@ -1979,14 +1980,14 @@ int main(int argc, char *argv[]){ //Print goodies, getch pause_game = 0; while(pause_game!=' '){ - mvprintw(10,20,"Level %d Completed. Press SPACE to continue.\n", level); + mvprintw(10,20,"Level %d Completed. Press SPACE to continue. ", level); refresh(); pause_game = block_getch(); }; if(level==24){ pause_game = 'f'; while(pause_game!=' '){ - mvprintw(11,21,"Victory!!!! Score: %d Press SPACE to exit\n", score); + mvprintw(11,21,"Victory!!!! Score: %d Press SPACE to exit. ", score); refresh(); pause_game = block_getch(); loopvar = 1; diff --git a/src/mishaps.cpp b/src/mishaps.cpp index 4d37530..ba20807 100644 --- a/src/mishaps.cpp +++ b/src/mishaps.cpp @@ -86,7 +86,7 @@ int life_loss(int lives, int score){ if(lives>=1){ pause_game = 0; while(pause_game!=' '){ - mvprintw(10,20,"Boom. Press SPACE to continue.\n"); + mvprintw(10,20,"Boom. Press SPACE to continue. "); refresh(); pause_game = block_getch(); }; @@ -119,10 +119,10 @@ int life_loss(int lives, int score){ }; while(pause_game!='y'&&pause_game!='n'){ - mvprintw(10,20,"GAME OVER. Score:%d Play again(y/n)?\n", score); if(score>hscore){ mvprintw(11,20,"High Score: %s", outstring); }; + mvprintw(10,20,"GAME OVER. Score:%d Play again (y/n) ? ", score); refresh(); pause_game = block_getch(); }; -- 2.9.0