diff --git a/android/Images/OtherIcons/Camera.png b/android/Images/OtherIcons/Camera.png new file mode 100644 index 0000000000..78ae6ed4c3 Binary files /dev/null and b/android/Images/OtherIcons/Camera.png differ diff --git a/android/assets/game.atlas b/android/assets/game.atlas index 3a96932756..bb42150eb5 100644 --- a/android/assets/game.atlas +++ b/android/assets/game.atlas @@ -410,6 +410,13 @@ OtherIcons/Crosshair orig: 100, 100 offset: 0, 0 index: -1 +OtherIcons/Camera + rotate: false + xy: 500, 500 + size: 100, 100 + orig: 100, 100 + offset: 0, 0 + index: -1 OtherIcons/DisbandUnit rotate: false xy: 1503, 1730 diff --git a/android/assets/game.png b/android/assets/game.png index e0630132eb..e8ea9d633b 100644 Binary files a/android/assets/game.png and b/android/assets/game.png differ diff --git a/core/src/com/unciv/ui/worldscreen/Minimap.kt b/core/src/com/unciv/ui/worldscreen/Minimap.kt index 91decc8328..31a303697f 100644 --- a/core/src/com/unciv/ui/worldscreen/Minimap.kt +++ b/core/src/com/unciv/ui/worldscreen/Minimap.kt @@ -2,8 +2,10 @@ package com.unciv.ui.worldscreen import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.g2d.Batch +import com.badlogic.gdx.math.MathUtils import com.badlogic.gdx.math.Vector2 import com.badlogic.gdx.scenes.scene2d.Group +import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.ui.Image import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.utils.Align @@ -21,6 +23,7 @@ import kotlin.math.min class Minimap(val mapHolder: WorldMapHolder) : Table(){ private val allTiles = Group() private val tileImages = HashMap() + private val scrollPosistionIndicator = ImageGetter.getImage("OtherIcons/Camera") init { isTransform = false // don't try to resize rotate etc - this table has a LOT of children so that's valuable render time! @@ -65,10 +68,28 @@ class Minimap(val mapHolder: WorldMapHolder) : Table(){ // so we zero out the starting position of the whole board so they will be displayed as well allTiles.setSize(topX - bottomX, topY - bottomY) + scrollPosistionIndicator.touchable = Touchable.disabled + allTiles.addActor(scrollPosistionIndicator) + add(allTiles) layout() } + fun updateScrollPosistion(scrollPos: Vector2, scale: Vector2){ + + val scrollPosistionIndicatorBaseScale = Vector2(allTiles.width / mapHolder.maxX, allTiles.height / mapHolder.maxY) + + scrollPosistionIndicator.scaleX = scrollPosistionIndicatorBaseScale.x * 10f * max(2f - scale.x, 0.25f) + scrollPosistionIndicator.scaleY = scrollPosistionIndicatorBaseScale.y * 10f * max(2f - scale.y, 0.25f) + + val scrollPositionIndicatorOffset = Vector2(-50f * scrollPosistionIndicator.scaleX, 125f + (50f * (1-scrollPosistionIndicator.scaleY))) + + val scrollPosOnMinimap = Vector2((scrollPos.x / mapHolder.maxX) * allTiles.width, (scrollPos.y / mapHolder.maxY) * allTiles.height) + scrollPosOnMinimap.x = MathUtils.clamp(scrollPosOnMinimap.x, -scrollPositionIndicatorOffset.x, allTiles.width + scrollPositionIndicatorOffset.x) + scrollPosOnMinimap.y = MathUtils.clamp(scrollPosOnMinimap.y, -scrollPositionIndicatorOffset.x, scrollPositionIndicatorOffset.y) + scrollPosistionIndicator.setPosition(scrollPositionIndicatorOffset.x + scrollPosOnMinimap.x, scrollPositionIndicatorOffset.y - scrollPosOnMinimap.y) + } + private class CivAndImage(val civInfo: CivilizationInfo, val image: IconCircleGroup) private val cityIcons = HashMap() diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt index 31daf815dc..37cbf8e09d 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreen.kt @@ -630,6 +630,10 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() { } // topBar.selectedCivLabel.setText(Gdx.graphics.framesPerSecond) // for framerate testing + var scrollPos = Vector2(mapHolder.scrollX, mapHolder.scrollY); + var viewScale = Vector2(mapHolder.scaleX, mapHolder.scaleY); + minimapWrapper.minimap.updateScrollPosistion(scrollPos, viewScale) + super.render(delta) }