-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtile.cpp
More file actions
executable file
·68 lines (52 loc) · 1.05 KB
/
tile.cpp
File metadata and controls
executable file
·68 lines (52 loc) · 1.05 KB
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
//AUTHORS: Matt Dumford, Anthony Phelps
#include "tile.h"
// tiles are a custom QPushButton that can send a signal with a pointer to
// themselves when clicked. they also hold their x and y positions in the grid.
Tile::Tile(int x, int y, const QIcon & icon, QWidget * parent) : QPushButton(icon, "", parent)
{
this->x = x;
this->y = y;
initX = x;
initY = y;
//custom signal to send a pointer to itself
QObject::connect(this, SIGNAL(clicked()), this, SLOT(onClick()));
}
Tile::Tile(const QString &text) : QPushButton(text)
{
}
Tile::Tile()
{
}
Tile::~Tile()
{
}
//get the x position of the tile
int Tile::getX()
{
return this->x;
}
//get the y position of the tile
int Tile::getY()
{
return this->y;
}
//get the initial x position of the tile
int Tile::getInitX()
{
return initX;
}
//get the initial y position of the tile
int Tile::getInitY()
{
return initY;
}
//set the x position of the tile
void Tile::setX(int a)
{
this->x = a;
}
//set the y position of the tile
void Tile::setY(int a)
{
this->y = a;
}