From 4ddc452303141e1e385f0eef99665583e6332a2e Mon Sep 17 00:00:00 2001 From: Tobse <1190109+TobseF@users.noreply.github.com> Date: Wed, 26 May 2021 21:05:55 +0200 Subject: [PATCH] Fix minesweeper board postion (#46) Move the board to the center by setting x and y. The `centerOnStage()` didn't worked. --- .../com/soywiz/korge/samples/minesweeper/Board.kt | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/game/minesweeper/src/commonMain/kotlin/com/soywiz/korge/samples/minesweeper/Board.kt b/game/minesweeper/src/commonMain/kotlin/com/soywiz/korge/samples/minesweeper/Board.kt index af9bae1..e0167e3 100644 --- a/game/minesweeper/src/commonMain/kotlin/com/soywiz/korge/samples/minesweeper/Board.kt +++ b/game/minesweeper/src/commonMain/kotlin/com/soywiz/korge/samples/minesweeper/Board.kt @@ -53,14 +53,8 @@ class Board( } //The board is centered on the screen - //x = screen.width / 2 - width / 2 - //y = screen.height / 2 - (height - 10 - FONT_HEIGHT) / 2 - - //x = views.virtualWidthDouble / 2 - width / 2 - //y = views.virtualHeightDouble / 2 - (height - 10 - FONT_HEIGHT) / 2 - - centerOnStage() - y += FONT_HEIGHT / 2 + x = views.virtualWidthDouble / 2 - (width / 2) + y = views.virtualHeightDouble / 2 - (height - 10 - FONT_HEIGHT) / 2 // Restart board restart()