-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenu.cpp
More file actions
executable file
·131 lines (118 loc) · 3.66 KB
/
Menu.cpp
File metadata and controls
executable file
·131 lines (118 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#include "Menu.h"
void Menu::printMenu()
{
std::cout << "Menu" << std::endl
<< "----" << std::endl
<< "1. New Game" << std::endl
<< "2. Load Game" << std::endl
<< "3. Credits" << std::endl
<< "4. Quit" << std::endl
<< std::endl;
}
std::string Menu::getInput()
{
std::string input;
std::cout << "> ";
std::getline(std::cin, input);
std::cout << input << std::endl;
return input;
}
void Menu::printCredits()
{
std::cout << std::endl
<< "----------------------------------" << std::endl
<< "Name: Luca Cave" << std::endl
<< "Student ID: s3787946" << std::endl
<< "Email: s3787946@student.rmit.edu.au" << std::endl
<< std::endl
<< "Name: Michael Sartorel" << std::endl
<< "Student ID: s3786267" << std::endl
<< "Email: s3786267@student.rmit.edu.au" << std::endl
<< std::endl
<< "Name: Dylan Dimkovski" << std::endl
<< "Student ID: s3717379" << std::endl
<< "Email: s3717379@student.rmit.edu.au" << std::endl
<< "----------------------------------" << std::endl
<< std::endl;
}
void Menu::printMessage(std::string message)
{
std::cout << std::endl
<< message
<< std::endl;
}
void Menu::handStart(string playername)
{
std::cout << "TURN FOR PLAYER: " << playername << std::endl;
std::cout << "Factories: \n";
}
void Menu::printFactory(int id, string contents)
{
std::cout << id << ": " << contents << std::endl;
std::cout << (id == 5 ? "\n" : "");
}
void Menu::printFactory(std::vector<TileType> *centerPile)
{
std::cout << "0: ";
for (TileType tile : *centerPile)
{
std::cout << (char)tile << " ";
}
std::cout << std::endl;
}
void Menu::printMosaic(Player *player)
{
std::cout << "Mosaic for " << player->getName() << std::endl;
for (int j = 0; j < NUMBER_OF_LINES; j++)
{
std::cout << j + 1 << ": ";
std::string output;
int lineSize = player->getMosaic()->getLine(j)->getMaxSize();
int numTiles = player->getMosaic()->getLine(j)->getNumTiles();
for (int i = 0; i < 5 - lineSize; i++)
{
output += " ";
}
for (int i = 0; i < lineSize - numTiles; i++)
{
output += ". ";
}
for (int i = 0; i < numTiles; i++)
{
output += " ";
output += player->getMosaic()->getLine(j)->getTileType();
}
output += " || ";
for (int i = 0; i < NUMBER_OF_LINES; i++)
{
if (player->getMosaic()->getWallLine(j)[i] == true)
{
output += " ";
output += master_wall[j][i];
}
else
{
output += " .";
}
}
std::cout << output << std::endl;
}
std::cout << "broken: " << player->getMosaic()->getBrokenTiles()->toString() << std::endl;
}
void Menu::printScore(string name, int score)
{
std::cout << name << " score: " << score << std::endl;
}
void Menu::gameOver(Player *player)
{
std::cout << "=== Game Over ===" << std::endl;
std::cout << "Player " << player->getName() << " wins!" << std::endl;
printScore(player->getName(), player->getScore());
}
void Menu::gameOver(string name1, string name2, int score)
{
std::cout << "=== Game Over ===" << std::endl;
std::cout << "Draw!" << std::endl;
std::cout << "Player " << name1 << " score: " << score << std::endl;
std::cout << "Player " << name2 << " score: " << score << std::endl;
}