X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=core%2Fsrc%2Fru%2Fdeadsoftware%2Fcavedroid%2Fgame%2Finput%2Fhandler%2Fkeyboard%2FMoveCursorControlsModeKeyboardInputHandler.kt;h=0cb74d7d0ff20bd0d01ceafa873b46f5bdea863c;hb=b2f824726f647543e69f31ac5723df37750b5778;hp=e6d00536239b1d7d03d369dbbc7967399a6becdf;hpb=c1b8f5c93482cb9933dd608c48f41622ce2994c6;p=cavedroid.git diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/MoveCursorControlsModeKeyboardInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/MoveCursorControlsModeKeyboardInputHandler.kt index e6d0053..0cb74d7 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/MoveCursorControlsModeKeyboardInputHandler.kt +++ b/core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/MoveCursorControlsModeKeyboardInputHandler.kt @@ -1,6 +1,5 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard -import com.badlogic.gdx.math.MathUtils import ru.deadsoftware.cavedroid.MainConfig import ru.deadsoftware.cavedroid.game.GameScope import ru.deadsoftware.cavedroid.game.input.IGameInputHandler @@ -27,21 +26,6 @@ class MoveCursorControlsModeKeyboardInputHandler @Inject constructor( action.actionKey is KeyboardInputActionKey.Down) } - private fun checkCursorBounds() { - val player = mobsController.player - if (player.gameMode == 0) { - val minCursorX = player.mapX - SURVIVAL_CURSOR_RANGE - val maxCursorX = player.mapX + SURVIVAL_CURSOR_RANGE - val minCursorY = player.middleMapY - SURVIVAL_CURSOR_RANGE - val maxCursorY = player.middleMapY + SURVIVAL_CURSOR_RANGE - - player.cursorX = MathUtils.clamp(player.cursorX, minCursorX, maxCursorX) - player.cursorY = MathUtils.clamp(player.cursorY, minCursorY, maxCursorY) - } - - player.cursorY = MathUtils.clamp(player.cursorY, 0, gameWorld.height - 1) - } - override fun handle(action: KeyboardInputAction) { val player = mobsController.player @@ -53,7 +37,7 @@ class MoveCursorControlsModeKeyboardInputHandler @Inject constructor( else -> return } - checkCursorBounds() + player.checkCursorBounds(gameWorld); } companion object {