DEADSOFTWARE

Input handler modules code generation
authorfredboy <fredboy@protonmail.com>
Tue, 14 May 2024 16:35:57 +0000 (23:35 +0700)
committerfredboy <fredboy@protonmail.com>
Tue, 14 May 2024 16:35:57 +0000 (23:35 +0700)
37 files changed:
core/src/ru/deadsoftware/cavedroid/game/GameRenderer.java
core/src/ru/deadsoftware/cavedroid/game/input/GameInputHandler.kt [new file with mode: 0644]
core/src/ru/deadsoftware/cavedroid/game/input/IGameInputHandler.kt [deleted file]
core/src/ru/deadsoftware/cavedroid/game/input/KeyboardInputHandlersModule.kt [deleted file]
core/src/ru/deadsoftware/cavedroid/game/input/MouseInputHandlersModule.kt [deleted file]
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/CloseGameWindowKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/DropItemKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/FlyDownKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/FlyUpKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/GoLeftKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/GoRightKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/JumpKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/MoveCursorControlsModeKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/OpenInventoryKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/PauseGameKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/SelectHotbarSlotKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/StopSwimKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/SwimUpKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleControlsModeKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleDebugInfoKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleGameModeKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/ToggleMinimapKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/keyboard/TurnOnFlyModeKeyboardInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/AbstractInventoryItemsMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/AttackMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CloseGameWindowMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CreativeInventoryScrollMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/CursorMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/HotbarMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectChestInventoryItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCraftingInventoryItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectCreativeInventoryItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectFurnaceInventoryItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/SelectSurvivalInventoryItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/mouse/UseItemMouseInputHandler.kt
core/src/ru/deadsoftware/cavedroid/game/input/handler/touch/JoystickInputHandler.kt
desktop/build.gradle

index 2ae4756f54ab06b08b1c309ca3330348f4726d3c..0dcbefcc575e7d3c2c0a1ded8b533bc5278dd3a6 100644 (file)
@@ -9,7 +9,8 @@ import com.badlogic.gdx.math.Vector2;
 import com.badlogic.gdx.utils.ObjectMap;
 import com.badlogic.gdx.utils.TimeUtils;
 import ru.deadsoftware.cavedroid.MainConfig;
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler;
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler;
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler;
 import ru.deadsoftware.cavedroid.game.input.Joystick;
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction;
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction;
@@ -51,8 +52,8 @@ public class GameRenderer extends Renderer {
     private final CursorMouseInputHandler mCursorMouseInputHandler;
     private final MouseInputActionMapper mMouseInputActionMapper;
     private final KeyboardInputActionMapper mKeyboardInputActionMapper;
-    private final Set<IGameInputHandler<MouseInputAction>> mMouseInputHandlers;
-    private final Set<IGameInputHandler<KeyboardInputAction>> mKeyboardInputHandlers;
+    private final Set<IMouseInputHandler> mMouseInputHandlers;
+    private final Set<IKeyboardInputHandler> mKeyboardInputHandlers;
     private final GameWindowsManager mGameWindowsManager;
     private final TooltipManager mTooltipManager;
 
@@ -71,8 +72,8 @@ public class GameRenderer extends Renderer {
                  CursorMouseInputHandler cursorMouseInputHandler,
                  MouseInputActionMapper mouseInputActionMapper,
                  KeyboardInputActionMapper keyboardInputActionMapper,
-                 Set<IGameInputHandler<MouseInputAction>> mouseInputHandlers,
-                 Set<IGameInputHandler<KeyboardInputAction>> keyboardInputHandlers,
+                 Set<IMouseInputHandler> mouseInputHandlers,
+                 Set<IKeyboardInputHandler> keyboardInputHandlers,
                  GameWindowsManager gameWindowsManager,
                  TooltipManager tooltipManager) {
         super(mainConfig.getWidth(), mainConfig.getHeight());
@@ -224,7 +225,7 @@ public class GameRenderer extends Renderer {
 
         boolean anyProcessed = false;
 
-        for (IGameInputHandler<MouseInputAction> handler : mMouseInputHandlers) {
+        for (IMouseInputHandler handler : mMouseInputHandlers) {
             final boolean conditions = handler.checkConditions(action);
             if (conditions) {
                 anyProcessed = true;
@@ -338,7 +339,7 @@ public class GameRenderer extends Renderer {
 
         boolean anyProcessed = false;
 
-        for (IGameInputHandler<KeyboardInputAction> handler : mKeyboardInputHandlers) {
+        for (IKeyboardInputHandler handler : mKeyboardInputHandlers) {
             final boolean conditions = handler.checkConditions(action);
             if (conditions) {
                 anyProcessed = true;
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/GameInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/GameInputHandler.kt
new file mode 100644 (file)
index 0000000..55dc618
--- /dev/null
@@ -0,0 +1,40 @@
+package ru.deadsoftware.cavedroid.game.input
+
+import ru.deadsoftware.cavedroid.game.input.action.IGameInputAction
+import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
+import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
+import ru.fredboy.cavedroid.ksp.annotations.GenerateSetMultibindingsModule
+
+@GenerateSetMultibindingsModule(
+    interfaceClass = IKeyboardInputHandler::class,
+    modulePackage = "ru.deadsoftware.cavedroid.game.input",
+    moduleName = "KeyboardInputHandlersModule"
+)
+annotation class KeyboardInputHandler
+
+@GenerateSetMultibindingsModule(
+    interfaceClass = IMouseInputHandler::class,
+    modulePackage = "ru.deadsoftware.cavedroid.game.input",
+    moduleName = "MouseInputHandlersModule"
+)
+annotation class MouseInputHandler
+
+interface IKeyboardInputHandler : IGameInputHandler<KeyboardInputAction>
+
+interface IMouseInputHandler : IGameInputHandler<MouseInputAction>
+
+interface IGameInputHandler<A : IGameInputAction> {
+
+    /**
+     * Implementation should check if conditions for handling an input are satisfied
+     * For example - inventory input handler should return false if inventory is closed
+     */
+    fun checkConditions(action: A): Boolean
+
+    /**
+     * Handle given input action.
+     * This will not be called if [checkConditions] returned false
+     */
+    fun handle(action: A)
+
+}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/IGameInputHandler.kt b/core/src/ru/deadsoftware/cavedroid/game/input/IGameInputHandler.kt
deleted file mode 100644 (file)
index a8eaad1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-package ru.deadsoftware.cavedroid.game.input
-
-import ru.deadsoftware.cavedroid.game.input.action.IGameInputAction
-
-interface IGameInputHandler<A : IGameInputAction> {
-
-    /**
-     * Implementation should check if conditions for handling an input are satisfied
-     * For example - inventory input handler should return false if inventory is closed
-     */
-    fun checkConditions(action: A): Boolean
-
-    /**
-     * Handle given input action.
-     * This will not be called if [checkConditions] returned false
-     */
-    fun handle(action: A)
-
-}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/KeyboardInputHandlersModule.kt b/core/src/ru/deadsoftware/cavedroid/game/input/KeyboardInputHandlersModule.kt
deleted file mode 100644 (file)
index a58e522..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-package ru.deadsoftware.cavedroid.game.input
-
-import dagger.Binds
-import dagger.Module
-import dagger.multibindings.IntoSet
-import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
-import ru.deadsoftware.cavedroid.game.input.handler.keyboard.*
-
-@Module
-object KeyboardInputHandlersModule {
-    
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindGoLeftKeyboardInputHandler(handler: GoLeftKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindGoRightKeyboardInputHandler(handler: GoRightKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindJumpKeyboardActionHandler(handler: JumpKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindFlyUpKeyboardActionHandler(handler: FlyUpKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindTurnOnFlyModeKeyboardActionHandler(handler: TurnOnFlyModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindFlyDownKeyboardActionHandler(handler: FlyDownKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindOpenInventoryKeyboardInputHandler(handler: OpenInventoryKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindCloseGameWindowKeyboardInputHandler(handler: CloseGameWindowKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindToggleDebugInfoKeyboardInputHandler(handler: ToggleDebugInfoKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindToggleMinimapKeyboardInputHandler(handler: ToggleMinimapKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindToggleGameModeKeyboardInputHandler(handler: ToggleGameModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindPauseGameKeyboardInputHandler(handler: PauseGameKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindToggleControlsModeKeyboardInputHandler(handler: ToggleControlsModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindMoveCursorControlsModeKeyboardInputHandler(handler: MoveCursorControlsModeKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindOpenCraftingKeyboardInputHandler(handler: DropItemKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindSwimUpKeyboardInputHandler(handler: SwimUpKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindStopSwimKeyboardInputHandler(handler: StopSwimKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindSelectHotbarSlotKeyboardInputHandler(handler: SelectHotbarSlotKeyboardInputHandler): IGameInputHandler<KeyboardInputAction> {
-        return handler
-    }
-
-}
\ No newline at end of file
diff --git a/core/src/ru/deadsoftware/cavedroid/game/input/MouseInputHandlersModule.kt b/core/src/ru/deadsoftware/cavedroid/game/input/MouseInputHandlersModule.kt
deleted file mode 100644 (file)
index f0c3b3b..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-package ru.deadsoftware.cavedroid.game.input
-
-import dagger.Binds
-import dagger.Module
-import dagger.multibindings.IntoSet
-import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
-import ru.deadsoftware.cavedroid.game.input.handler.touch.JoystickInputHandler
-import ru.deadsoftware.cavedroid.game.input.handler.mouse.*
-
-@Module
-object MouseInputHandlersModule {
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindCursorMouseInputHandler(handler: CursorMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindHoldHotbarMouseInputHandler(handler: HotbarMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindCloseGameWindowMouseActionHandler(handler: CloseGameWindowMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindCreativeInventoryScrollMouseInputHandler(handler: CreativeInventoryScrollMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindSelectCreativeInventoryItemMouseActionHandler(handler: SelectCreativeInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindAttackMouseInputHandler(handler: AttackMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindUseItemMouseInputActionHandler(handler: UseItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindSelectSurvivalInventoryItemMouseInputHandler(handler: SelectSurvivalInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindSelectCraftingInventoryItemMouseInputHandler(handler: SelectCraftingInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindSelectFurnaceInventoryItemMouseInputHandler(handler: SelectFurnaceInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindJoystickInputHandler(handler: JoystickInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-
-    @Binds
-    @IntoSet
-    @GameScope
-    fun bindSelectChestInventoryItemMouseInputHandler(handler: SelectChestInventoryItemMouseInputHandler): IGameInputHandler<MouseInputAction> {
-        return handler
-    }
-}
\ No newline at end of file
index 89a7b693c02492243440ca4385805bc462e47924..cbc254e9d8ff6e910c142acb9d8555c692d70764 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -11,11 +12,12 @@ import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class CloseGameWindowKeyboardInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
     private val dropController: DropController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.OpenInventory &&
index 04f5520af367a3123bb331181e265dc20aaf0855..01a0c1f162e8e95622a9dedebd6c96b11636954f 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -13,11 +14,12 @@ import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class DropItemKeyboardInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
     private val dropController: DropController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.DropItem &&
index 0bb0a772e8d0ae54f51f21464a46c02289cfb128..8e41dfec9bd8e30ca1867dba349a6fad0a540f45 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -10,10 +11,11 @@ import ru.deadsoftware.cavedroid.game.mobs.player.Player
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class FlyDownKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.Down &&
index bf12c1ad14aed9a0068ef42b9f2ba5e212148bbe..976b069692325453bfea465caee772b84be2cd06 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -10,10 +11,11 @@ import ru.deadsoftware.cavedroid.game.mobs.player.Player
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class FlyUpKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.Up &&
index 421e47e5a56ce72de6a3fc6ea602c19583edca48..823447617d01721a4cdf7f3c091b953e3cffe5b5 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.Mob
@@ -11,10 +12,11 @@ import ru.deadsoftware.cavedroid.game.mobs.player.Player
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class GoLeftKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.Left &&
index e3f5bf99f054c658aa6e402994794578f9d707e1..3139a179742ecc4924666246bb1be8486395cc87 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.Mob
@@ -11,10 +12,11 @@ import ru.deadsoftware.cavedroid.game.mobs.player.Player
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class GoRightKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.Right &&
index 1e68cea9f4ca2639f882544553c359d673039268..30f12dd383de0e4f37f4340d088a6f81771797e5 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -10,10 +11,11 @@ import ru.deadsoftware.cavedroid.game.mobs.player.Player
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class JumpKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.Up &&
index 0cb74d7d0ff20bd0d01ceafa873b46f5bdea863c..98d3e0aa913e7b9acb4c4cd52ce2e81998c4b2fb 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -11,11 +12,12 @@ import ru.deadsoftware.cavedroid.game.world.GameWorld
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class MoveCursorControlsModeKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
     private val gameWorld: GameWorld,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return mainConfig.isTouch &&
index ec8190a40c2a3902888a404463ab5fc0e0eb9d03..a1ca3da81d67099ec85a5aefe3173b5078d3b328 100644 (file)
@@ -2,16 +2,18 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class OpenInventoryKeyboardInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.OpenInventory &&
index b39ee7403ee30f69ca8676f8c3906b63e4c3a79c..e4d670738853bcf4405e8a2e9949d1f0c9af7a1f 100644 (file)
@@ -4,7 +4,8 @@ import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameSaver
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -15,6 +16,7 @@ import ru.deadsoftware.cavedroid.game.world.GameWorld
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class PauseGameKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val dropController: DropController,
@@ -22,7 +24,7 @@ class PauseGameKeyboardInputHandler @Inject constructor(
     private val gameWorld: GameWorld,
     private val containerController: ContainerController,
     private val gameWindowsManager: GameWindowsManager,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.Pause && action.isKeyDown
index 45e04da208433324c6463a6f4ccef974510bbe4d..0c7ea74c2474d5a47b7425f34a6201b63a246305 100644 (file)
@@ -1,16 +1,18 @@
 package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class SelectHotbarSlotKeyboardInputHandler @Inject constructor(
     private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.SelectHotbarSlot &&
index e25a99f7216551c151abb9b6a134c0db6d6f4ac3..7256c5402274b911b4cc95b33bc77f35355e4c7d 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -11,11 +12,12 @@ import ru.deadsoftware.cavedroid.game.world.GameWorld
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class StopSwimKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
     private val gameWorld: GameWorld,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.Up && !action.isKeyDown &&
index 3159e7fb363f321d95469748a69d07851ab048b4..9dc4777e0374dc7d0e28b54647273dd7fd5b587e 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -11,11 +12,12 @@ import ru.deadsoftware.cavedroid.game.world.GameWorld
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class SwimUpKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
     private val gameWorld: GameWorld,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     private fun checkSwim(): Boolean {
         return gameWorld.getForeMap(mobsController.player.mapX, mobsController.player.lowerMapY).isFluid()
index fc95e29b84794fb271aa3520cf09d58f0b6d7b20..a933c80e488537c214522ea0be9d9a2fbf2790ce 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -10,10 +11,11 @@ import ru.deadsoftware.cavedroid.game.mobs.player.Player
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class ToggleControlsModeKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.SwitchControlsMode && !action.isKeyDown
index 96bc21d9719433bf027bb7ec96b75cb859964d9e..065b28cd63e1e21f122f0f5fcef8db761eb02936 100644 (file)
@@ -2,15 +2,17 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class ToggleDebugInfoKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.ShowDebug && action.isKeyDown
index ef4e696c2833613708f25c8ee99a2e458ffae5e4..a17e6d253c960154dabdafa71daf38f2937a827c 100644 (file)
@@ -1,16 +1,18 @@
 package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class ToggleGameModeKeyboardInputHandler @Inject constructor(
     private val mobsController: MobsController
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
index d39dfdbc818c618608dc2a69637c40a3e1bd88a6..6f22e4ca2ac84353e46d0d8fe42710a3f7b8e4c5 100644 (file)
@@ -2,15 +2,17 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class ToggleMinimapKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return action.actionKey is KeyboardInputActionKey.ShowMap && action.isKeyDown
index f3b65eb0a226899e466dda68814586f56e574ca2..3b43d31b00daf8058c0a6ca6d9b49fd083c0bb66 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.keyboard
 
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IKeyboardInputHandler
+import ru.deadsoftware.cavedroid.game.input.KeyboardInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.KeyboardInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.KeyboardInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
@@ -10,10 +11,11 @@ import ru.deadsoftware.cavedroid.game.mobs.player.Player
 import javax.inject.Inject
 
 @GameScope
+@KeyboardInputHandler
 class TurnOnFlyModeKeyboardInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
-) : IGameInputHandler<KeyboardInputAction> {
+) : IKeyboardInputHandler {
 
     override fun checkConditions(action: KeyboardInputAction): Boolean {
         return mobsController.player.gameMode == 1 && action.actionKey is KeyboardInputActionKey.Up &&
index dec8b7db0a65c8b32a530e655b5537ce17c9590a..3b925b09b58f53bcb5b7de2865f3e37b4a87f3fb 100644 (file)
@@ -3,7 +3,7 @@ package ru.deadsoftware.cavedroid.game.input.handler.mouse
 import com.badlogic.gdx.graphics.g2d.TextureRegion
 import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideWindow
@@ -17,7 +17,7 @@ abstract class AbstractInventoryItemsMouseInputHandler(
     private val gameItemsHolder: GameItemsHolder,
     private val gameWindowsManager: GameWindowsManager,
     private val windowType: GameUiWindow,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     protected abstract val windowTexture: TextureRegion
 
index 2afc3d5b1bbb50d6310f0fa4a247926c29bd9d3b..c2a22ede8b003fc1c5352555af6acde44ea661ca 100644 (file)
@@ -2,7 +2,8 @@ package ru.deadsoftware.cavedroid.game.input.handler.mouse
 
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideHotbar
@@ -12,11 +13,12 @@ import ru.deadsoftware.cavedroid.game.world.GameWorld
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class AttackMouseInputHandler @Inject constructor(
     private val mobsController: MobsController,
     private val gameWorld: GameWorld,
     private val gameWindowsManager: GameWindowsManager
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     override fun checkConditions(action: MouseInputAction): Boolean {
         return gameWindowsManager.getCurrentWindow() == GameUiWindow.NONE &&
index f6f6cfc97eeb83ad0a126225decd6d84b260e685..b5ff2c5a069b0b98cad49888f5934bdfaee1c9e7 100644 (file)
@@ -4,7 +4,8 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideWindow
@@ -14,11 +15,12 @@ import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class CloseGameWindowMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
     private val dropController: DropController,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     private val creativeInventoryTexture get() = requireNotNull(Assets.textureRegions["creative"])
     private val survivalInventoryTexture get() = requireNotNull(Assets.textureRegions["survival"])
index 11f76e9a691fd8a34c2086fdc21c4023ab592481..bf6ba3721e5e9f685f223aae67dd44040d872e88 100644 (file)
@@ -6,7 +6,8 @@ import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideWindow
@@ -15,11 +16,12 @@ import javax.inject.Inject
 import kotlin.math.abs
 
 @GameScope
+@MouseInputHandler
 class CreativeInventoryScrollMouseInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val gameWindowsManager: GameWindowsManager,
     private val gameItemsHolder: GameItemsHolder,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     private val creativeInventoryTexture get() = requireNotNull(Assets.textureRegions["creative"])
 
index 454337eefb744f6f8a4803283299ddd28a2e694a..5d5c79f78e2e94d6d475920dfd11be332636b2ff 100644 (file)
@@ -5,7 +5,8 @@ import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.mobs.Mob
@@ -22,6 +23,7 @@ import ru.deadsoftware.cavedroid.misc.utils.px
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class CursorMouseInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
@@ -29,7 +31,7 @@ class CursorMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val gameItemsHolder: GameItemsHolder,
     private val tooltipManager: TooltipManager,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     private val player get() = mobsController.player
 
index 18cd41ddb2d36401321b83acf84364c1c4317afa..45ae49b4747de4a0f3265797c51a3275a065c04b 100644 (file)
@@ -4,7 +4,8 @@ import com.badlogic.gdx.utils.Timer
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.handler.keyboard.DropItemKeyboardInputHandler.Companion.DROP_DISTANCE
@@ -18,11 +19,12 @@ import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class HotbarMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
     private val dropController: DropController,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     private val hotbarTexture get() = requireNotNull(Assets.textureRegions["hotbar"])
 
index d47202e181bfe330a010c991668a54b15032f300..3118e9fdf705ddc4ef798b19681bfc3f825d3858 100644 (file)
@@ -3,6 +3,7 @@ package ru.deadsoftware.cavedroid.game.input.handler.mouse
 import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
@@ -12,6 +13,7 @@ import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class SelectChestInventoryItemMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
index 88e362005316a756b7e0aaf829493fe20d5a3747..cc993c99a5e81f3afcd1d761a0cbd57ad72873e2 100644 (file)
@@ -3,6 +3,7 @@ package ru.deadsoftware.cavedroid.game.input.handler.mouse
 import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
@@ -12,6 +13,7 @@ import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class SelectCraftingInventoryItemMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
index 272a17874b69897af5f4b3376131cdc61cfca5ea..5c6975fbb5c5aa9ab9d0f344306167f80b673525 100644 (file)
@@ -4,7 +4,8 @@ import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsManager
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideWindow
@@ -14,11 +15,12 @@ import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class SelectCreativeInventoryItemMouseInputHandler @Inject constructor(
     private val gameItemsHolder: GameItemsHolder,
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     private val creativeInventoryTexture get() = requireNotNull(Assets.textureRegions["creative"])
 
index f4a00eb9b18d22ed512557393bde5ba1e1342790..164b0c1dcb3d54fe3bfb287eb4984a57cdb6d538 100644 (file)
@@ -3,6 +3,7 @@ package ru.deadsoftware.cavedroid.game.input.handler.mouse
 import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import ru.deadsoftware.cavedroid.game.model.item.InventoryItem.Companion.isNoneOrNull
@@ -14,6 +15,7 @@ import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class SelectFurnaceInventoryItemMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
index 0a455ab2c70c47e53824d4225a0d395078c0809e..9f25b9adc9b59942f3622b3e74e6f503921f534d 100644 (file)
@@ -3,6 +3,7 @@ package ru.deadsoftware.cavedroid.game.input.handler.mouse
 import ru.deadsoftware.cavedroid.game.GameItemsHolder
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import ru.deadsoftware.cavedroid.game.ui.windows.GameWindowsConfigs
@@ -12,6 +13,7 @@ import ru.deadsoftware.cavedroid.misc.Assets
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class SelectSurvivalInventoryItemMouseInputHandler @Inject constructor(
     private val gameWindowsManager: GameWindowsManager,
     private val mobsController: MobsController,
index 04bc6198295fcf3fede52cfa413b685f3c6b6d9b..c0ff332e393509e174edf0c1e1fb57e0fab1254a 100644 (file)
@@ -9,7 +9,8 @@ import ru.deadsoftware.cavedroid.game.actions.placeToForegroundAction
 import ru.deadsoftware.cavedroid.game.actions.placeblock.IPlaceBlockAction
 import ru.deadsoftware.cavedroid.game.actions.useblock.IUseBlockAction
 import ru.deadsoftware.cavedroid.game.actions.useitem.IUseItemAction
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
+import ru.deadsoftware.cavedroid.game.input.IMouseInputHandler
+import ru.deadsoftware.cavedroid.game.input.MouseInputHandler
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
 import ru.deadsoftware.cavedroid.game.input.isInsideHotbar
@@ -20,6 +21,7 @@ import ru.deadsoftware.cavedroid.game.world.GameWorld
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class UseItemMouseInputHandler @Inject constructor(
     private val mobsController: MobsController,
     private val useItemActionMap: Map<String, @JvmSuppressWildcards IUseItemAction>,
@@ -27,7 +29,7 @@ class UseItemMouseInputHandler @Inject constructor(
     private val useBlockActionMap: Map<String, @JvmSuppressWildcards IUseBlockAction>,
     private val gameWindowsManager: GameWindowsManager,
     private val gameWorld: GameWorld,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     private var buttonHoldTask: Timer.Task? = null
 
index 1c020a5c189bd982493cd21b46f49c6687b62224..b6f31a3bd77e1b3e7e4bdbc5f6667e8ee8c00c8c 100644 (file)
@@ -4,11 +4,9 @@ import com.badlogic.gdx.utils.TimeUtils
 import ru.deadsoftware.cavedroid.MainConfig
 import ru.deadsoftware.cavedroid.game.GameScope
 import ru.deadsoftware.cavedroid.game.GameUiWindow
-import ru.deadsoftware.cavedroid.game.input.IGameInputHandler
-import ru.deadsoftware.cavedroid.game.input.Joystick
+import ru.deadsoftware.cavedroid.game.input.*
 import ru.deadsoftware.cavedroid.game.input.action.MouseInputAction
 import ru.deadsoftware.cavedroid.game.input.action.keys.MouseInputActionKey
-import ru.deadsoftware.cavedroid.game.input.isInsideHotbar
 import ru.deadsoftware.cavedroid.game.mobs.Mob
 import ru.deadsoftware.cavedroid.game.mobs.MobsController
 import ru.deadsoftware.cavedroid.game.mobs.player.Player
@@ -17,12 +15,13 @@ import ru.deadsoftware.cavedroid.game.world.GameWorld
 import javax.inject.Inject
 
 @GameScope
+@MouseInputHandler
 class JoystickInputHandler @Inject constructor(
     private val mainConfig: MainConfig,
     private val mobsController: MobsController,
     private val gameWindowsManager: GameWindowsManager,
     private val gameWorld: GameWorld,
-) : IGameInputHandler<MouseInputAction> {
+) : IMouseInputHandler {
 
     private var activateTimeMs = 0L
     private var cursorTimeoutMs = 100L
index 58553a37aa12bf8a975da701cb9d299b03bef8a7..912734500bc8b2c2b414039e17cc9ef830176306 100644 (file)
@@ -13,7 +13,7 @@ sourceSets.main.resources.srcDirs = ["../android/assets"]
 project.ext.mainClassName = "ru.deadsoftware.cavedroid.desktop.DesktopLauncher"
 project.ext.assetsDir = new File("../android/assets")
 
-task run(dependsOn: classes, type: JavaExec) {
+task run(dependsOn: build, type: JavaExec) {
     main = project.mainClassName
     classpath = sourceSets.main.runtimeClasspath
     standardInput = System.in
@@ -22,7 +22,7 @@ task run(dependsOn: classes, type: JavaExec) {
     args "--debug"
 }
 
-task runTouch(dependsOn: classes, type: JavaExec) {
+task runTouch(dependsOn: build, type: JavaExec) {
     main = project.mainClassName
     classpath = sourceSets.main.runtimeClasspath
     standardInput = System.in
@@ -31,16 +31,7 @@ task runTouch(dependsOn: classes, type: JavaExec) {
     args "--touch", "--debug"
 }
 
-task debug(dependsOn: classes, type: JavaExec) {
-    main = project.mainClassName
-    classpath = sourceSets.main.runtimeClasspath
-    standardInput = System.in
-    workingDir = project.assetsDir
-    ignoreExitValue = true as JavaExecSpec
-    debug = true
-}
-
-task dist(type: Jar) {
+task dist(dependsOn: build, type: Jar) {
     duplicatesStrategy = DuplicatesStrategy.EXCLUDE
     manifest {
         attributes 'Main-Class': project.mainClassName
@@ -51,8 +42,6 @@ task dist(type: Jar) {
     with jar
 }
 
-dist.dependsOn build
-
 dependencies {
     implementation project(":core")
     implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializationVersion"