From a3995aab81fddd3ca6960b3ce24d2371eb00ef23 Mon Sep 17 00:00:00 2001 From: fredboy Date: Mon, 15 Apr 2024 03:15:42 +0700 Subject: [PATCH] Fix blocks at x=0 not selectable by mouse --- core/src/ru/deadsoftware/cavedroid/game/GameInput.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameInput.java b/core/src/ru/deadsoftware/cavedroid/game/GameInput.java index 09a7e70..2376bb1 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameInput.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameInput.java @@ -164,12 +164,13 @@ public class GameInput { mCurX += mPlayer.looksLeft() ? 1 : -1; } } else if (!mMainConfig.isTouch()) { - mCurX = (int) (Gdx.input.getX() * (mMainConfig.getWidth() / - Gdx.graphics.getWidth()) + gameRenderer.getCamX()) / 16; + final int tmpX = (int) (Gdx.input.getX() * (mMainConfig.getWidth() / + Gdx.graphics.getWidth()) + gameRenderer.getCamX()); + mCurX = tmpX / 16; mCurY = (int) (Gdx.input.getY() * (mMainConfig.getHeight() / Gdx.graphics.getHeight()) + gameRenderer.getCamY()) / 16; - if (mCurX < 0) { + if (tmpX < 0) { mCurX--; } } -- 2.29.2