summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3512986)
raw | patch | inline | side by side (parent: 3512986)
author | fredboy <fredboy@protonmail.com> | |
Sun, 21 Apr 2024 14:13:17 +0000 (21:13 +0700) | ||
committer | fredboy <fredboy@protonmail.com> | |
Sun, 21 Apr 2024 14:14:34 +0000 (21:14 +0700) |
core/src/ru/deadsoftware/cavedroid/game/render/RenderModule.kt | patch | blob | history | |
core/src/ru/deadsoftware/cavedroid/game/render/TouchControlsRenderer.kt | patch | blob | history |
diff --git a/core/src/ru/deadsoftware/cavedroid/game/render/RenderModule.kt b/core/src/ru/deadsoftware/cavedroid/game/render/RenderModule.kt
index a23ae32ea7e241cbf4139717b3d7c30998637148..9ae3b462bfceb9ba88509d3059faef3fe0e5e6e4 100644 (file)
@GameScope
fun bindWindowsRenderer(renderer: WindowsRenderer): IGameRenderer = renderer
+ @Binds
+ @IntoSet
+ @GameScope
+ fun bindTouchControlsRenderer(renderer: TouchControlsRenderer): IGameRenderer = renderer
+
@Binds
@IntoSet
@GameScope
diff --git a/core/src/ru/deadsoftware/cavedroid/game/render/TouchControlsRenderer.kt b/core/src/ru/deadsoftware/cavedroid/game/render/TouchControlsRenderer.kt
index e8b19d013f0d5a1431f27582f0d39b59c4b137b2..c9f2bccb4d57b83dc24bd08dfe27cdfdbf89b799 100644 (file)
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.ShapeRenderer
import com.badlogic.gdx.math.Rectangle
+import ru.deadsoftware.cavedroid.MainConfig
import ru.deadsoftware.cavedroid.game.GameInput
import ru.deadsoftware.cavedroid.game.GameScope
import ru.deadsoftware.cavedroid.misc.Assets
@GameScope
class TouchControlsRenderer @Inject constructor(
+ private val mainConfig: MainConfig,
private val gameInput: GameInput
) : IGameRenderer {
private val shadeTexture get() = Assets.textureRegions[SHADE_KEY]
override fun draw(spriteBatch: SpriteBatch, shapeRenderer: ShapeRenderer, viewport: Rectangle, delta: Float) {
+ if (!mainConfig.isTouch) {
+ return
+ }
+
val touchControlsMap = Assets.guiMap
touchControlsMap.forEach { (key, value) ->