summaryrefslogtreecommitdiff
path: root/square.cpp
diff options
context:
space:
mode:
authordaniel-Jones <daniel@danieljon.es>2018-09-02 15:02:05 +0930
committerdaniel-Jones <daniel@danieljon.es>2018-09-02 15:02:05 +0930
commitfed9330a4a98906648306e7524882feac80980e4 (patch)
tree7d30af29b1a8a4fbe2fe34d8dffca4f9fc4445f5 /square.cpp
parent12f885b28b9740349dcee6a7c57d7b774017fd05 (diff)
downloadqtminesweeper-fed9330a4a98906648306e7524882feac80980e4.tar.gz
qtminesweeper-fed9330a4a98906648306e7524882feac80980e4.zip
added constants files, moved around some classes, beginning of drawing functions etc
Diffstat (limited to 'square.cpp')
-rw-r--r--square.cpp41
1 files changed, 12 insertions, 29 deletions
diff --git a/square.cpp b/square.cpp
index be0b32c..1faab09 100644
--- a/square.cpp
+++ b/square.cpp
@@ -20,24 +20,15 @@ square::square()
{
}
-void square::setrealx(int x)
-{
- realx = x;
-}
-
-void square::setrealy(int y)
-{
- realy = y;
-}
-void square::setgridx(int x)
+int square::getgridx()
{
- gridx = x;
+ return gridx;
}
-void square::setgridy(int y)
+int square::getgridy()
{
- gridy = y;
+ return gridy;
}
int square::getrealx()
@@ -49,26 +40,18 @@ int square::getrealy()
{
return realy;
}
-
-int square::getgridx()
-{
- return gridx;
-}
-
-int square::getgridy()
-{
- return gridy;
-}
-
void square::movetorealpos(int x, int y)
{
- setrealx(x);
- setrealy(y);
+ realx = x;
+ realy = y;
}
void square::movetogridpos(int x, int y)
{
- setgridx(x);
- setgridy(y);
-
+ gridx = x;
+ gridy = y;
+ int rx, ry;
+ rx = x * SQUARESIZE + BORDEROFFSET;
+ ry = y * SQUARESIZE + BORDEROFFSET;
+ movetorealpos(rx, ry);
}