summaryrefslogtreecommitdiff
path: root/square.cpp
diff options
context:
space:
mode:
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);
}