-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
77 lines (74 loc) · 2.43 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
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
#include <iostream>
#include "LocalArea.h"
#include "Player.h"
#include <ncurses.h>
#include "CharRaster.h"
#include "Color.h"
/*TODO
debug by having lineTo print to cerr the coordinates of each location it finds.
*/
using namespace std;
int main()
{
initscr();
raw();
noecho();
keypad(stdscr, true);
define_colors();
const TerrainType floor('.');
const TerrainType wall('#', WHITEBLACK, false, false);
const TerrainType six('6', REDBLACK);
const TerrainType four('4');
const TerrainType five('5');
const TerrainType stair('=');
LocalArea bigPlace(floor, 9, 9);
for (int i = 0; i < bigPlace.getHeight(); i++)
{
if (i != bigPlace.getHeight()/2)
{
bigPlace.setTerrain(wall, 0, i);
bigPlace.setTerrain(wall, bigPlace.getWidth()-1, i);
}
}
for (int j = 0; j < bigPlace.getWidth(); j++)
{
if (j != bigPlace.getWidth()/2)
{
bigPlace.setTerrain(wall, j, 0);
bigPlace.setTerrain(wall, j, bigPlace.getHeight()-1);
}
}
bigPlace.setTerrain(six, 7, 7);
LocalArea bottomStair(stair, 1, 1);
bigPlace.nullTerrain(3, 3);
bigPlace.addBorderArea(BorderArea(bottomStair, 3, 3, 5));
bottomStair.addBorderArea(BorderArea(bigPlace, -3, -3, -5));
LocalArea stairs(stair, 1, 3);
bottomStair.addBorderArea(BorderArea(stairs, 0, -3));
stairs.addBorderArea(BorderArea(bottomStair, 0, 3));
LocalArea topStair(stair, 1, 1);
stairs.addBorderArea(BorderArea(topStair, 0, -1));
bigPlace.nullTerrain(5, 5);
bigPlace.addBorderArea(BorderArea(topStair, 5, 5));
topStair.addBorderArea(BorderArea(bigPlace, -5, -5, 5));
topStair.addBorderArea(BorderArea(stairs, 0, 1, -5));
bigPlace.addBorderArea(BorderArea(bigPlace, 0, -9, 0, DEGREE_0));
bigPlace.addBorderArea(BorderArea(bigPlace, -9, 0, 0, DEGREE_90));
bigPlace.addBorderArea(BorderArea(bigPlace, 0, 9, 0, DEGREE_180));
bigPlace.addBorderArea(BorderArea(bigPlace, 9, 0, 0, DEGREE_270));
LocalArea testPlace(floor, 14, 14);
for (int j = 0; j < testPlace.getWidth(); j++)
{
if (j != testPlace.getWidth()/2)
{
testPlace.setTerrain(wall, j, 0);
testPlace.setTerrain(wall, j, testPlace.getHeight()-1);
}
}
Body character(Location(bigPlace, 2, 2), 4, '@', GREENBLACK);
Player player(character);
refresh();
player.controlLoop();
endwin();
return 0;
}