Compare commits
13 Commits
quit-bugfi
...
v1.28
| Author | SHA1 | Date | |
|---|---|---|---|
| 2855b64f03 | |||
| 9c45259962 | |||
| b1256014e3 | |||
| b1af7b4f41 | |||
| 2b0f20d65a | |||
| e394d0986e | |||
| d8eb655dd7 | |||
| b878c2ddb3 | |||
| a0e5850e68 | |||
| 84972ed9bb | |||
| 08f6ee7161 | |||
| f7d2f138ea | |||
| 1d07cee01a |
@@ -39,7 +39,7 @@ $(shell mkdir -p $(RLS_DIR))
|
||||
$(shell mkdir -p $(BUILD_DIR))
|
||||
|
||||
# phony rules
|
||||
.PHONY := all debug release clean install uninstall
|
||||
.PHONY = all debug release clean install uninstall
|
||||
|
||||
all: release
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ $(shell if not exist $(RLS_DIR) mkdir $(RLS_DIR))
|
||||
$(shell if not exist $(BUILD_DIR) mkdir $(BUILD_DIR))
|
||||
|
||||
# phony rules
|
||||
.PHONY := all debug release clean libraries_debug libraries_release both
|
||||
.PHONY = all debug release clean libraries_debug libraries_release both
|
||||
|
||||
all: release
|
||||
|
||||
|
||||
21
src/main.cpp
21
src/main.cpp
@@ -44,7 +44,8 @@ void startGame(Board &board)
|
||||
{
|
||||
usleep((1000 / MAX_TIME) * 1000);
|
||||
#ifndef _WIN32
|
||||
if((w.ws_row < boardSize.x + 3 )||( w.ws_col < boardSize.y + 2)) {
|
||||
if ((w.ws_row < boardSize.x + 3) || (w.ws_col < boardSize.y + 2))
|
||||
{
|
||||
mvprintw(w.ws_col / 2, w.ws_row / 2, "Your terminal is too small:");
|
||||
mvprintw(w.ws_col / 2 + 1, w.ws_row / 2, "Current size: %dx%d", w.ws_row, w.ws_col);
|
||||
mvprintw(w.ws_col / 2 + 2, w.ws_row / 2, "Min size: %dx%d", boardSize.x + 3, boardSize.y + 2);
|
||||
@@ -177,10 +178,10 @@ void startGame(Board &board)
|
||||
cursorX = (cursorX < boardSize.x - 1) ? cursorX + 1 : 0;
|
||||
break;
|
||||
case 'q':
|
||||
exit(0);
|
||||
echo();
|
||||
cbreak();
|
||||
endwin();
|
||||
exit(0);
|
||||
break;
|
||||
case 'z':
|
||||
if (!somethingHasBeenDone)
|
||||
@@ -282,11 +283,13 @@ void startGame(Board &board)
|
||||
{
|
||||
Board newBoard(boardSize.x, boardSize.y, board.getMineCount());
|
||||
startGame(newBoard);
|
||||
} else if(c == 'q') {
|
||||
exit(0);
|
||||
}
|
||||
else if (c == 'q')
|
||||
{
|
||||
echo();
|
||||
cbreak();
|
||||
endwin();
|
||||
exit(0);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -312,11 +315,13 @@ void startGame(Board &board)
|
||||
{
|
||||
Board newBoard(boardSize.x, boardSize.y, board.getMineCount());
|
||||
startGame(newBoard);
|
||||
} else if(c == 'q') {
|
||||
exit(0);
|
||||
}
|
||||
else if (c == 'q')
|
||||
{
|
||||
echo();
|
||||
cbreak();
|
||||
endwin();
|
||||
exit(0);
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -324,14 +329,18 @@ void startGame(Board &board)
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
signal(SIGWINCH, handleSIGWINCH);
|
||||
#endif
|
||||
setlocale(LC_ALL, "");
|
||||
initscr();
|
||||
noecho();
|
||||
cbreak();
|
||||
keypad(stdscr, TRUE);
|
||||
nodelay(stdscr, TRUE);
|
||||
#ifndef _WIN32
|
||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||
#endif
|
||||
|
||||
start_color();
|
||||
init_pair(1, COLOR_BLUE, COLOR_BLACK);
|
||||
|
||||
Reference in New Issue
Block a user