diff --git a/app/build.gradle b/app/build.gradle index 4ffcc2f0c..852ce64dd 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -14,8 +14,8 @@ android { defaultConfig { // versionCode and versionName must be hardcoded to support F-droid - versionCode 1001041 - versionName '10.1.4' + versionCode 1001051 + versionName '10.1.5' minSdkVersion 21 targetSdkVersion 30 multiDexEnabled true diff --git a/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt b/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt index 12ee0e67c..4222ad585 100644 --- a/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt +++ b/app/src/main/java/dev/lucasnlm/antimine/GameActivity.kt @@ -152,7 +152,7 @@ class GameActivity : tapToBegin.visibility = View.GONE } - if (it.turn < 3 && it.saveId == 0L) { + if (it.turn < 1 && it.saveId == 0L) { val color = usingTheme.palette.covered.toAndroidColor(168) val tint = ColorStateList.valueOf(color) val controlText = gameViewModel.getControlDescription(applicationContext) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 0cee5c66a..70d2f4128 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -6,6 +6,7 @@ android:layout_height="match_parent" android:fitsSystemWindows="false" android:animateLayoutChanges="true" + android:paddingHorizontal="16dp" tools:context=".main.MainActivity"> renderSettings.areaSize) { + camera.run { + translate(dx, dy, 0f) + update(true) + Gdx.graphics.requestRendering() + } + } + } } companion object { diff --git a/gdx/src/main/java/dev/lucasnlm/antimine/gdx/stages/MinefieldStage.kt b/gdx/src/main/java/dev/lucasnlm/antimine/gdx/stages/MinefieldStage.kt index 82040211e..5b0de2024 100644 --- a/gdx/src/main/java/dev/lucasnlm/antimine/gdx/stages/MinefieldStage.kt +++ b/gdx/src/main/java/dev/lucasnlm/antimine/gdx/stages/MinefieldStage.kt @@ -70,11 +70,12 @@ class MinefieldStage( fun changeZoom(zoomMultiplier: Float) { (camera as OrthographicCamera).apply { val newZoom = if (zoomMultiplier > 1.0) { - zoom + 2.0f * zoomMultiplier * Gdx.graphics.deltaTime + zoom + zoom * zoomMultiplier * Gdx.graphics.deltaTime } else { - zoom - 2.0f * (1.0f / zoomMultiplier) * Gdx.graphics.deltaTime + zoom - 2.0f * zoom * (1.0f / zoomMultiplier) * Gdx.graphics.deltaTime } zoom = newZoom.coerceIn(0.7f, 4.0f) + currentZoom = zoom update(true) GdxLocal.zoomLevelAlpha = when { @@ -327,6 +328,11 @@ class MinefieldStage( } } + override fun touchUp(screenX: Int, screenY: Int, pointer: Int, button: Int): Boolean { + cameraController.freeTouch(screenX.toFloat(), screenY.toFloat()) + return super.touchUp(screenX, screenY, pointer, button) + } + override fun touchDragged(screenX: Int, screenY: Int, pointer: Int): Boolean { return minefieldSize?.let { val dx = Gdx.input.deltaX.toFloat() @@ -336,12 +342,17 @@ class MinefieldStage( inputEvents.clear() } - if (dx * dx + dy * dy > actionSettings.touchSensibility * 8) { - cameraController.addVelocity( - -dx * currentZoom, - dy * currentZoom, - ) - } + cameraController.startTouch( + x = screenX.toFloat(), + y = screenY.toFloat(), + ) + + cameraController.translate( + dx = -dx * currentZoom, + dy = dy * currentZoom, + x = screenX.toFloat(), + y = screenY.toFloat(), + ) true } != null