DEADSOFTWARE

96bc21d9719433bf027bb7ec96b75cb859964d9e
[cavedroid.git] /
1 package ru.deadsoftware.cavedroid.game.input.handler.keyboard
3 import ru.deadsoftware.cavedroid.MainConfig
4 import ru.deadsoftware.cavedroid.game.GameScope
5 import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
6 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
7 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
8 import javax.inject.Inject
10 @GameScope
11 class ToggleDebugInfoKeyboardInputHandler @Inject constructor(
12 private val mainConfig: MainConfig
13 ) : IGameInputHandler<KeyboardInputAction> {
15 override fun checkConditions(action: KeyboardInputAction): Boolean {
16 return action.actionKey is KeyboardInputActionKey.ShowDebug && action.isKeyDown
17 }
19 override fun handle(action: KeyboardInputAction) {
20 mainConfig.isShowInfo = !mainConfig.isShowInfo
21 }
22 }