This repository was archived by the owner on Feb 3, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
91 lines (77 loc) · 1.62 KB
/
main.cpp
File metadata and controls
91 lines (77 loc) · 1.62 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
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <conio.h>
#include <windows.h>
#include "Cell.h"
#include "Grid.h"
#include "myconio.h"
#include "Timer.h"
using namespace std;
char move(Grid &g){
char sign;
sign = getch();
switch(sign){
case 'w':
g.moveCursor(0, -1);
break;
case 's':
g.moveCursor(0, 1);
break;
case 'a':
g.moveCursor(-1, 0);
break;
case 'd':
g.moveCursor(1, 0);
break;
case 13:
g.switchFlag();
break;
case 32:
if(g.checkField()) return 27;
break;
case '*':
g.switchDevTools();
break;
case '.':
g.switchShowBomb();
break;
case 'r':
g.restart();
}
return sign;
}
void hideCursor(){
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO info;
info.dwSize = 100;
info.bVisible = FALSE;
SetConsoleCursorInfo(consoleHandle, &info);
}
int main() {
hideCursor();
char check;
<<<<<<< Updated upstream
Grid g(Professional);
=======
Grid g(Difficulty::Medium);
>>>>>>> Stashed changes
do{
while(check != 27 && !g.checkWon()){
g.render();
check = move(g);
}
system("cls");
if(g.checkWon())
g.setLabel("G A M E O V E R ! W I N");
else
g.setLabel("G A M E O V E R ! L O S E");
g.render();
check = getch();
if(check == 'r'){
g.restart();
g.setLabel("M I N E S W E E P E R");
system("cls");
}
}while(check == 'r');
}