-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUI.cpp
More file actions
138 lines (111 loc) · 3.31 KB
/
UI.cpp
File metadata and controls
138 lines (111 loc) · 3.31 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
132
133
134
135
136
137
138
# include <simplecpp>
# include <string>
# include "Help.h"
# include "Control.h"
# include "main.h"
# include "lasso.h"
# include "Store.h"
# include "Levels.h"
main_program{
/* Graphical components of the interface */
initCanvas("Interface",1000,800);
Circle L(500,200,400);
L.setColor(COLOR("red"));
L.setFill(true);
Circle L2(500,200,200);
L2.setColor(COLOR("brown"));
L2.setFill(true);
Text Intro(500,200,"Welcome to The Lasso Game!");
Intro.setColor(COLOR("yellow"));
Text Name(500,250,"Enter username in terminal to initiate: ");
/* Coins on the sides of the home interface */
Circle NCoin(100,100,50);
NCoin.setColor(COLOR("gold"));
NCoin.setFill(true);
Circle BCoin(900,100,50);
BCoin.setColor(COLOR("black"));
BCoin.setFill(true);
Circle MCoin(100,250,50);
MCoin.setColor(COLOR("silver"));
MCoin.setFill(true);
Circle TCoin(900,250,50);
TCoin.setColor(COLOR("blue"));
TCoin.setFill(true);
Circle FCoin(100,400,50);
FCoin.setColor(COLOR("cyan"));
FCoin.setFill(true);
Circle RCoin(900,400,50);
RCoin.setColor(COLOR("purple"));
RCoin.setFill(true);
Circle SCoin(100,550,50);
SCoin.setColor(COLOR("red"));
SCoin.setFill(true);
Circle ECoin(900,550,50);
ECoin.setColor(COLOR("green"));
ECoin.setFill(true);
Circle YCoin(100,700,50);
YCoin.setColor(COLOR("magenta"));
YCoin.setFill(true);
Circle LCoin(900,700,50);
LCoin.setColor(COLOR("brown"));
LCoin.setFill(true);
/*Play button */
Rectangle Rp(300,500,200,100);
Rp.setColor(COLOR("yellow"));
Rp.setFill(true);
Text Play(300,500,"Play game");
/* Info button*/
Rectangle Ri(700,500,200,100);
Ri.setColor(COLOR("yellow"));
Ri.setFill(true);
Text Help(700,500,"Help");
/* Quit button */
Rectangle Rq(300,700,200,100);
Rq.setColor(COLOR("yellow"));
Rq.setFill(true);
Text Quit(300,700,"Quit");
/* Achievements button */
Rectangle Ra(700,700,200,100);
Ra.setColor(COLOR("yellow"));
Ra.setFill(true);
Text Stats(700,700,"Statistics");
/* Enter username and display it on log in interface*/
string name;
cout<<"Enter username in terminal to initiate: ";
getline(cin,name);
while(true){
if(name.find(" ")!=-1){
cout<<"Username must be a single word without any spaces"<<endl;
cout<<"Enter username in terminal to initiate: ";
getline(cin,name);
}
else{
break;
}
}
Rectangle Rt(500,250,textWidth("Enter username(single word) in terminal to initiate: "),textHeight());
Rt.setColor(COLOR(255,255,255));
Rt.setFill(true);
Text Name1(500,250,name); //Username
//Different options like help, play, quit
while(true)
{
int s=getClick();
if (Click(Rp,s))
{
levels(name); /*To play the game*/
}
else if (Click(Ri,s))
{
help_sec(); /*For help and instructions*/
}
else if (Click(Rq,s)) /* To quit the application only after logging in */
{
exit(0);
}
else if (Click(Ra,s))
{
view(name); /* To view the performance statistics */
}
}
}