Skip to content
Permalink
12d06b305d
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
78 lines (74 sloc) 1.99 KB
#include <string>
#include "../include/Game.hpp"
#include <ncurses.h>
#include "../include/GameWindow.hpp"
#include <array>
using namespace std;
void MainGame()
{
/* Setting up windows using GameWindow class */
initscr();
//start_color();
//init_pair(1, COLOR_BLACK, COLOR_WHITE);
GameWindow main_screen(LINES * 4/5, COLS * 2/3, 0, 0);
GameWindow vitals(LINES * 4/5, COLS * 1/3, 0, COLS * 2/3);
GameWindow menu_box(3, COLS * 2/3, LINES * 4/5, 0);
GameWindow menu_desc(LINES * 1/5 - 3, COLS * 2/3, LINES * 4/5 + 3, 0);
GameWindow text_box(LINES * 1/5, COLS * 1/3, LINES * 4/5, COLS * 2/3);
noecho();
curs_set(0);
cbreak();
vitals.Print("Test window");
vitals.PrintNewl("This is a string of text that is pretty long, so it should go over to the next line.");
//menu_box.Print("Another test", true);
/* Creating menu buttons and descriptions */
vector<vector<string>> abil =
{
{"Attack", "A powerful attack!"},
{"Defend", "Raise your shield!"},
{"Fireball", "Burn your enemies!"},
{"Heal", "Heal yourself!"},
{"Ultimate", "Your ultimate move!"},
{"Transform", "Become different!"}
};
bool game_over = false;
int current_player = 1;
int choice = -1;
string to_print = "Player " + to_string(current_player) + "'s turn!";
text_box.Clear();
text_box.Print(to_print);
getch();
while(!game_over)
{
//text_box.Clear();
to_print = "Player " + to_string(current_player) + "'s turn!";
text_box.PrintNewl(to_print);
getch();
choice = menu_box.Menu(abil, menu_desc);
if(choice == 5)
{
game_over = true;
text_box.Clear();
to_print = "Player " + to_string(current_player) + " wins!!!";
text_box.Print(to_print);
break;
}
if(current_player == 1)
{
current_player = 2;
}
else
{
current_player = 1;
}
text_box.PrintNewl("This is yet another test to see if this prints properly.");
}
text_box.Print("Another test");
getch();
main_screen.Clear(false);
vitals.Clear(false);
menu_box.Clear(false);
text_box.Clear(false);
menu_desc.Clear(false);
endwin();
}