summaryrefslogtreecommitdiffstats
path: root/src/glchessboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/glchessboard.cpp')
-rw-r--r--src/glchessboard.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/glchessboard.cpp b/src/glchessboard.cpp
index afab9e8..c47fea5 100644
--- a/src/glchessboard.cpp
+++ b/src/glchessboard.cpp
@@ -30,3 +30,11 @@ void GLChessboard::drawBoard(GLESRenderer *renderer)
field.draw(renderer);
}
}
+
+QVector3D GLChessboard::fieldToPosition(const QPoint &field)
+{
+ double fieldWidth = m_width / 8;
+ double fieldHeight = m_height / 8;
+
+ return QVector3D(fieldWidth/2 + field.x() * fieldWidth, fieldHeight/2 + field.y() * fieldHeight, 0.0);
+}