Permalink
Cannot retrieve contributors at this time
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?
Dungeon-Game/mainmenu.h
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
48 lines (45 sloc)
1.23 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "IO.cpp" | |
using namespace std; | |
string menu() | |
{ | |
system("clear"); | |
string choice; | |
cout << "Welcome to Ruin Explorer!" << endl; | |
cout << "-Press Enter to Start" << endl; | |
cout << "-Press Space for Instructions" << endl; | |
cout << "-Press Esc to Quit" << endl; | |
bool stop = false; | |
while( stop == false ) | |
{ | |
int input = mygetch(); | |
if( input == 10 ) | |
{ | |
stop = true; | |
string name; | |
cout << "************************" << endl; | |
cout << "Please input your player name: "; | |
cin >> name; | |
return name; | |
} | |
else if( input == 32 ) | |
{ | |
stop = true; | |
cout << "************************" << endl; | |
cout << "Controls:" << endl; | |
cout << "-W A S D to move" << endl; | |
cout << "-Enter to attack" << endl; | |
cout << "-Esc to Quit" << endl; | |
cout << "************************" << endl; | |
input = mygetch(); | |
string name = menu(); | |
return name; | |
} | |
else if( input == 27 ) | |
{ | |
stop = true; | |
cout << "Exiting..." << endl; | |
exit(0); | |
} | |
} | |
} |