-
Notifications
You must be signed in to change notification settings - Fork 0
/
Elements.h
101 lines (67 loc) · 1.79 KB
/
Elements.h
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
//
// Created by mbshqqb on 17-1-1.
//
#ifndef TANKGAME_ELEMENTS_H
#define TANKGAME_ELEMENTS_H
#include <iostream>
#include "DEFINE.h"
struct GameSpaceUnit {
GameSpaceUnit();
GameSpaceUnit(int, int, bool);
GameSpaceUnit &operator=(GameSpaceUnit &);
int tankId;
int kind;
bool have;
};
struct GridUnit {
// struct function
GridUnit();
GridUnit(GridUnit &);
GridUnit(int, int);
// operator function
GridUnit &operator=(GridUnit &);
bool operator==(GridUnit &);
bool operator!=(GridUnit &);
// data
int x, y;
};
struct Wall {
// struct function
Wall(GameSpaceUnit **&, int w = MAP_NUMX, int h = MAP_NUMY, std::string = "〓");
// functional function
void set_brick(std::string);
/*"┏","┓","┗","┛","━","┃"*/
void set_brick(std::string, std::string, std::string, \
std::string, std::string, std::string);
void draw(int= 0, int= 0);
void erase();
// data
std::string upLeftBrick; // 左上角砖块
std::string upRightBrick; // 右上角砖块
std::string bottomLeftBrick; // 左下角砖块
std::string bottomRightBrick; // 右下角砖块
std::string horizonBrick; // 水平砖块
std::string verticalBrick; // 竖直砖块
int x;
int y;
int wide;
int high;
};
struct Map {
Map();
void load(GameSpaceUnit **&, int);
void clear();
void draw();
int mapId; // 当前使用的地图
bool exist[MAP_COUNT][MAP_NUMY][MAP_NUMX]; // 地图集
};
struct Frame {
Frame(int= 4, int= 4);
void draw_frame(int= 0, int= 0);
void clear_frame();
int x;
int y;
int wide;
int high;
};
#endif //TANKGAME_ELEMENTS_H