-
Notifications
You must be signed in to change notification settings - Fork 1
/
tile.h
72 lines (62 loc) · 1.13 KB
/
tile.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
#ifndef _TILE_H_
#define _TILE_H_
#include "image.h"
#include "draw.h"
enum TileType {grassType, dirtType, endType};
class Tile {
public:
float x, y, width, height;
Image *texture;
TileType type;
bool build, path;
int dir;
Tile();
Tile(Image *img, float x, float y, TileType type);
Tile(Image *img, float x, float y, TileType type, int dir);
void draw();
} nullTile;
Tile::Tile()
{
width = height = 0;
build = path = 0;
}
Tile::Tile(Image *img, float x, float y, TileType type)
{
texture = img;
this->x = x;
this->y = y;
this->width = g.tile_pxSize;
this->height = g.tile_pxSize;
this->type = type;
if (type == dirtType || type == endType) {
path = 1;
build = 0;
}
if (type == grassType) {
path = 0;
build = 1;
}
}
Tile::Tile(Image *img, float x, float y, TileType type, int dir)
{
texture = img;
this->x = x;
this->y = y;
this->width = g.tile_pxSize;
this->height = g.tile_pxSize;
this->type = type;
this-> dir = dir;
if (type == dirtType) {
path = 1;
build = 0;
}
if (type == grassType) {
path = 0;
build = 1;
}
}
void Tile::draw()
{
drawQuadTex(*texture, x, y, width, height);
}
#endif //_TILE_H_