Skip to content
Permalink
master
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
#include "Game.hpp"
using namespace std;
Game::Game()
{
quit = false;
this->currentState = nullptr;
this->character = new Character("Bob");
}
Game::~Game()
{
delete this->character;
}
const bool& Game::getQuit() const
{
return (this->quit);
}
void Game::mainMenu()
{
system("read -p 'Press Enter to continue...' var");
system("clear");
std::cout <<"--- Escape The Dungeon Boi ---"<<"\n"
<<"(1) Start Game"<<"\n"
<<"(2) Save"<<"\n"
<<"(3) Quit "<<"\n";
}
void Game::printMenu() const
{
system("read -p 'Press Enter to continue...' var");
system("clear");
std::cout <<"--- Gaming ---"<<"\n"
<<this->character->getMenuBar()<<"\n"
<<"(1) Character Stats"<<"\n"
<<"(2) Inventory"<<"\n"
<<"(3) Shop"<<"\n"
<<"(4) Travel"<<"\n"
<<"(5) Rest"<<"\n"
<<"(6) Main Menu "<<"\n";
}
const int Game::getChoice() const
{
int choice = 0;
cout << "Enter choice: ";
cin >> choice;
return choice;
}
void Game::startMenu()
{
switch(this->getChoice()|system("clear"))
{
case 1:
this->printMenu();
break;
case 2:
break;
case 3:
std::cout << "--- QUITTING GAME ---" << "\n"<<std::endl;
this->quit = true;
break;
default:
cout << "--- No such option in menu! ---" << "\n";
break;
}
}
void Game::updateMenu()
{
switch(this->getChoice()|system("clear"))
{
//case 0:
// std::cout << "--- QUITTING GAME ---" << "\n"<<std::endl;
// this->quit = true;
// break;
case 1:
std::cout << "--- Character Stats ---"<<"\n"<<"\n"<<std::endl;
std::cout <<this->character->toString()<<"\n";
break;
case 2:
std::cout << "--- Invertory ---" << "\n"<<std::endl;
if(this->character->updateLevel())
{
std::cout<<"LEVEL UP!"<<"\n"<<std::endl;
}
break;
case 3:
std::cout << "--- Shop ---" << "\n"<<std::endl;
break;
case 4:
std::cout << "--- Travel ---" << "\n"<<std::endl;
break;
case 5:
std::cout << "--- Rest ---" << "\n"<<std::endl;
break;
case 6:
this->update2();
break;
default:
cout << "--- No such option in menu! ---" << "\n";
break;
}
}
void Game::update2()
{
this->mainMenu();
this->startMenu();
}
void Game::update()
{
this->printMenu();
this->updateMenu();
}