DEADSOFTWARE

Fix blocks at x=0 not selectable by mouse
authorfredboy <fredboy@protonmail.com>
Sun, 14 Apr 2024 20:15:42 +0000 (03:15 +0700)
committerfredboy <fredboy@protonmail.com>
Sun, 14 Apr 2024 20:15:42 +0000 (03:15 +0700)
core/src/ru/deadsoftware/cavedroid/game/GameInput.java

index 09a7e7056383298ecddde2ccc2fdf890a9298dd1..2376bb110d28e9ee1f8c30639c5c9ac8d34fd5f2 100644 (file)
@@ -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--;
             }
         }