Initial commit
This commit is contained in:
54
main.cpp
Normal file
54
main.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifdef USE_NCURSES
|
||||
#include <ncurses.h>
|
||||
#else
|
||||
#include <curses.h>
|
||||
#endif
|
||||
|
||||
#include "chess.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
char input[2], nickname[2][40];
|
||||
WINDOW *win;
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
initscr();
|
||||
start_color();
|
||||
noqiflush();
|
||||
init_pair(0, COLOR_WHITE, COLOR_BLACK);
|
||||
win = newwin(0,0,0,0);
|
||||
|
||||
for (;;) {
|
||||
refresh();
|
||||
wrefresh(win);
|
||||
wattron(win, COLOR_PAIR(0));
|
||||
wclear(win);
|
||||
|
||||
wprintw(win, "\t*** Smirky-Chess v3.0 (beta) ***\n\n"
|
||||
"1. New game.\n"
|
||||
"2. Export player. (Not yet implemented)\n"
|
||||
"3. Import player. (Not yet implemented)\n"
|
||||
"4. Exit.\n"
|
||||
"\tINPUT: "
|
||||
);
|
||||
wgetnstr(win, input, 2);
|
||||
|
||||
if (input[0] == '1') {
|
||||
wprintw(win, "Enter nicknames:\n"
|
||||
"Player 1: ");
|
||||
wgetnstr(win, nickname[0], sizeof(nickname[0]));
|
||||
wprintw(win, "Player 2: ");
|
||||
wgetnstr(win, nickname[1], sizeof(nickname[1]));
|
||||
wattroff(win, COLOR_PAIR(0));
|
||||
|
||||
chess chess_game(nickname[0], nickname[1]);
|
||||
chess_game.play();
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
delwin(win);
|
||||
endwin();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user