diff --git a/core/src/main/java/dev/lucasnlm/antimine/core/models/Area.kt b/core/src/main/java/dev/lucasnlm/antimine/core/models/Area.kt index 972beeeee..582eb4ef3 100644 --- a/core/src/main/java/dev/lucasnlm/antimine/core/models/Area.kt +++ b/core/src/main/java/dev/lucasnlm/antimine/core/models/Area.kt @@ -19,4 +19,11 @@ data class Area( companion object { const val BYTE_SIZE = 20 * Int.SIZE_BYTES } + + val isOdd: Boolean = + if (posY % 2 == 0) { + posX % 2 != 0 + } else { + posX % 2 == 0 + } } diff --git a/gdx/src/main/java/dev/lucasnlm/antimine/gdx/GameApplicationListener.kt b/gdx/src/main/java/dev/lucasnlm/antimine/gdx/GameApplicationListener.kt index 19292c3db..cbf85a288 100644 --- a/gdx/src/main/java/dev/lucasnlm/antimine/gdx/GameApplicationListener.kt +++ b/gdx/src/main/java/dev/lucasnlm/antimine/gdx/GameApplicationListener.kt @@ -138,6 +138,8 @@ class GameApplicationListener( atlas = null } + minefieldStage.dispose() + Gdx.input.inputProcessor = null boundMinefield = null } diff --git a/gdx/src/main/java/dev/lucasnlm/antimine/gdx/actors/AreaActor.kt b/gdx/src/main/java/dev/lucasnlm/antimine/gdx/actors/AreaActor.kt index 384241066..7a42872bf 100644 --- a/gdx/src/main/java/dev/lucasnlm/antimine/gdx/actors/AreaActor.kt +++ b/gdx/src/main/java/dev/lucasnlm/antimine/gdx/actors/AreaActor.kt @@ -87,7 +87,6 @@ class AreaActor( bottomRight = field.getOrNull(bottomRightId)?.canLinkTo(area) == true, ) } - else -> { AREA_NO_FORM } @@ -341,12 +340,7 @@ class AreaActor( val area = this.area ?: return batch?.run { - val isOdd: Boolean = - if (area.posY % 2 == 0) { - area.posX % 2 != 0 - } else { - area.posX % 2 == 0 - } + val isOdd = area.isOdd drawBackground(this, isOdd) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c4bf080ed..88f4ea1d4 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ coreKtxVersion = "1.5.0" coreSplashscreen = "1.1.0-alpha02" espressoCore = "3.5.1" fragmentKtx = "1.6.2" -gdx = "1.11.0" +gdx = "1.12.1" google-coreKtx = "1.8.1" junit = "4.13.2" junitVersion = "1.1.5"