forked from JohnAnthony/TROG
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trog.cpp
54 lines (44 loc) · 904 Bytes
/
trog.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
46
47
48
49
50
51
52
53
54
#include <cstdlib>
#include <ctime>
#include "game.hpp"
#include "character.hpp"
#include "gui.hpp"
#include <signal.h>
Game *g = NULL;
Character *c;
static void
resize_handler(int sign) {
if (g)
g->HandleResize(sign);
else
refresh();
}
static void
interrupt_handler(int sign) {
erase();
endwin();
puts("SIGINT received; exiting cleanly.");
delete g;
delete c;
exit(0);
}
int main(int argc, char** argv) {
bool playagain;
srand(time(NULL));
GUI::Init();
signal(SIGINT, interrupt_handler);
signal(SIGWINCH, resize_handler);
for (int i = 0; i < 8; ++i)
init_pair(i, i, COLOR_BLACK);
do {
erase();
GUI::StartScreen();
c = GUI::CharacterCreation();
g = new Game(c);
playagain = g->Run();
} while (playagain);
GUI::End();
delete g;
delete c;
return 0;
}