DEADSOFTWARE

Less scale on android
authorfred-boy <fred-boy@protonmail.com>
Thu, 19 Apr 2018 12:33:36 +0000 (19:33 +0700)
committerfred-boy <fred-boy@protonmail.com>
Thu, 19 Apr 2018 12:33:36 +0000 (19:33 +0700)
build.gradle
core/src/ru/deadsoftware/cavecraft/InputHandler.java
core/src/ru/deadsoftware/cavecraft/game/GameInputHandler.java
core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java

index 268317dc574b21cfcf66c77032bb04920724f8f8..a9fac5c5f7b57ee23fe71bad50c53630502f0604 100644 (file)
@@ -8,7 +8,7 @@ buildscript {
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:2.2.0'
+        classpath 'com.android.tools.build:gradle:2.1.3'
         
 
     }
@@ -77,4 +77,4 @@ project(":core") {
 
 tasks.eclipse.doLast {
     delete ".project"
-}
\ No newline at end of file
+}
index 4ceb0f87051031621a8c3a7b97f04239a4b8ec24..da3e9e43d9be2deaf71a0454ae92f0a92d288519 100644 (file)
@@ -18,8 +18,8 @@ public class InputHandler implements InputProcessor {
     public InputHandler(GameProc gameProc) {
         this.gameProc = gameProc;
         this.gameInput = new GameInputHandler(gameProc);
-        tWidth = gameProc.renderer.touchCam.viewportWidth;
-        tHeight = gameProc.renderer.touchCam.viewportHeight;
+        tWidth = gameProc.renderer.camera.viewportWidth;
+        tHeight = gameProc.renderer.camera.viewportHeight;
     }
 
     @Override
index 61b52e41cce84814fe03b5e859707abaacb10f2f..e8c31be65e7c4eb2f2409a1952cf7aa8a87d0d63 100644 (file)
@@ -113,10 +113,6 @@ public class GameInputHandler {
             }
         } else if (CaveGame.STATE == GameState.GAME_CREATIVE_INV) {
             CaveGame.STATE = GameState.GAME_PLAY;
-        } else if (button == Input.Buttons.RIGHT &&
-                !gameProc.player.canJump && !gameProc.player.flyMode) {
-            gameProc.world.placeToForeground(gameProc.cursorX, gameProc.cursorY,
-                    gameProc.player.inventory[gameProc.invSlot]);
         } else {
             gameProc.touchDownX = screenX;
             gameProc.touchDownY = screenY;
index f1e830d61586e77267c6ca88b8494f8e84aeff6d..e119487ee12355a107125409e99e15927cf9eea7 100644 (file)
@@ -18,9 +18,9 @@ public class GameRenderer {
 
     private GameProc gameProc;
 
-    public OrthographicCamera camera, fontCam, touchCam;
+    public OrthographicCamera camera, fontCam;
     ShapeRenderer shapeRenderer;
-    SpriteBatch spriteBatch, fontBatch, touchBatch;
+    SpriteBatch spriteBatch, fontBatch;
 
     public GameRenderer(GameProc gameProc) {
         Gdx.gl.glClearColor(0f,.6f,.6f,1f);
@@ -30,8 +30,8 @@ public class GameRenderer {
             camera.setToOrtho(true, 480,
                     480 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
         } else {
-            camera.setToOrtho(true, 240,
-                    240 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
+            camera.setToOrtho(true, 320,
+                    320 * ((float) GameScreen.getHeight() / GameScreen.getWidth()));
         }
         shapeRenderer = new ShapeRenderer();
         shapeRenderer.setProjectionMatrix(camera.combined);
@@ -43,11 +43,6 @@ public class GameRenderer {
         fontCam.setToOrtho(true, GameScreen.getWidth(), GameScreen.getHeight());
         fontBatch = new SpriteBatch();
         fontBatch.setProjectionMatrix(fontCam.combined);
-        touchCam = new OrthographicCamera();
-        touchCam.setToOrtho(true, 240,
-                240*((float)GameScreen.getHeight()/GameScreen.getWidth()));
-        touchBatch = new SpriteBatch();
-        touchBatch.setProjectionMatrix(touchCam.combined);
     }
 
     private void setFontColor(int r, int g, int b) {
@@ -192,13 +187,13 @@ public class GameRenderer {
     }
 
     private void drawTouchGui() {
-        touchBatch.draw(Assets.touchArrows[0],26,touchCam.viewportHeight-52);
-        touchBatch.draw(Assets.touchArrows[1],0,touchCam.viewportHeight-26);
-        touchBatch.draw(Assets.touchArrows[2],26,touchCam.viewportHeight-26);
-        touchBatch.draw(Assets.touchArrows[3],52,touchCam.viewportHeight-26);
-        touchBatch.draw(Assets.touchLMB, touchCam.viewportWidth-52, touchCam.viewportHeight-26);
-        touchBatch.draw(Assets.touchRMB, touchCam.viewportWidth-26, touchCam.viewportHeight-26);
-        touchBatch.draw(Assets.touchToggleMode, 78, touchCam.viewportHeight-26);
+        spriteBatch.draw(Assets.touchArrows[0],26,camera.viewportHeight-52);
+        spriteBatch.draw(Assets.touchArrows[1],0,camera.viewportHeight-26);
+        spriteBatch.draw(Assets.touchArrows[2],26,camera.viewportHeight-26);
+        spriteBatch.draw(Assets.touchArrows[3],52,camera.viewportHeight-26);
+        spriteBatch.draw(Assets.touchLMB, camera.viewportWidth-52, camera.viewportHeight-26);
+        spriteBatch.draw(Assets.touchRMB, camera.viewportWidth-26, camera.viewportHeight-26);
+        spriteBatch.draw(Assets.touchToggleMode, 78, camera.viewportHeight-26);
     }
 
     private void drawGamePlay() {
@@ -225,9 +220,9 @@ public class GameRenderer {
         spriteBatch.end();
 
         if (CaveGame.TOUCH) {
-            touchBatch.begin();
+            spriteBatch.begin();
             drawTouchGui();
-            touchBatch.end();
+            spriteBatch.end();
         }
 
         fontBatch.begin();