From cc64e9b8c50ff520f85f5fd94798a5ef0f7cae02 Mon Sep 17 00:00:00 2001 From: Lucas Lima Date: Sat, 18 Nov 2023 19:48:42 -0300 Subject: [PATCH 1/2] Bump libgdx version --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c4bf080e..88f4ea1d 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" From bc8a4f0a3de44cec10fa05a32666db0150b5d56b Mon Sep 17 00:00:00 2001 From: Lucas Lima Date: Sat, 18 Nov 2023 20:11:38 -0300 Subject: [PATCH 2/2] Add dispose to state --- .../main/java/dev/lucasnlm/antimine/core/models/Area.kt | 7 +++++++ .../dev/lucasnlm/antimine/gdx/GameApplicationListener.kt | 2 ++ .../java/dev/lucasnlm/antimine/gdx/actors/AreaActor.kt | 8 +------- 3 files changed, 10 insertions(+), 7 deletions(-) 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 972beeee..582eb4ef 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 19292c3d..cbf85a28 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 38424106..7a42872b 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)