-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (42 loc) · 1.04 KB
/
main.cpp
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
#include <ncurses.h>
#include "Display.hpp"
#include "Game.hpp"
#include "Logger.hpp"
int main() {
Display *nCurse = new Display(210, 42);
if (nCurse->IsInit())
{
bool relaunch = true;
while (relaunch) {
Game::Instance->GameLoop();
delete Game::Instance;
Game::Instance = 0;
delete nCurse;
nCurse = new Display(210, 42);
Display::PutStr("G A M E O V E R ", (Display::sizeX / 2) - 7, Display::sizeY / 2);
Display::PutStr("Press r to relaunch", (Display::sizeX / 2) - 7, (Display::sizeY / 2) + 2);
Display::PutStr("Press q to quit", (Display::sizeX / 2) - 7, (Display::sizeY / 2) + 3);
Display::Refresh();
bool isRunning = true;
while (isRunning) {
int key = Display::GetKey();
if (key == 'q') {
isRunning = false;
relaunch = false;
}
if (key == 'r') {
isRunning = false;
Game::Instance = new Game();
delete nCurse;
nCurse = new Display(210, 42);
}
}
}
}
else
{
Logger::LogToFile("Error when loading ncurses !");
}
//delete Game::Instance;
delete nCurse;
}