You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KED/ked/ncurses/training/game/main.cpp

33 lines
614 B

#include <ncurses.h>
#include "player.hpp"
int main(int argv, char ** argc)
{
//variables
int i,std_xMax, std_yMax = 0;
//Init Ncurses
initscr();
noecho();
cbreak();
getmaxyx(stdscr, std_yMax, std_xMax);
WINDOW * play_win = newwin(20, 50, std_yMax/2-10, 10);
keypad(play_win, true); // so that we can use the arrow keys
box(play_win,0,0);
Player *player = new Player(play_win, 1, 1, '#');
printw("Press x to quit");
printw("\nPress arrow keys to move");
refresh();
wrefresh(play_win);
do{
player->display();
wrefresh(play_win);
}while(player->getMv()!='x');
endwin();
}