mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-13 12:27:40 +07:00
Smoother map panning
This commit is contained in:
parent
93bdb137f9
commit
48f68c6bd0
@ -183,7 +183,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
object : InputListener() {
|
||||
private val pressedKeys = mutableSetOf<Int>()
|
||||
private var infiniteAction: RepeatAction? = null
|
||||
private val amountToMove = 30 / mapHolder.scaleX
|
||||
private val amountToMove = 6 / mapHolder.scaleX
|
||||
private val ALLOWED_KEYS = setOf(Input.Keys.W, Input.Keys.S, Input.Keys.A, Input.Keys.D,
|
||||
Input.Keys.UP, Input.Keys.DOWN, Input.Keys.LEFT, Input.Keys.RIGHT)
|
||||
|
||||
@ -194,7 +194,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
pressedKeys.add(keycode)
|
||||
if (infiniteAction == null) {
|
||||
// create a copy of the action, because removeAction() will destroy this instance
|
||||
infiniteAction = Actions.forever(Actions.delay(0.05f, Actions.run { whileKeyPressedLoop() }))
|
||||
infiniteAction = Actions.forever(Actions.delay(0.01f, Actions.run { whileKeyPressedLoop() }))
|
||||
mapHolder.addAction(infiniteAction)
|
||||
}
|
||||
return true
|
||||
|
Loading…
Reference in New Issue
Block a user