From cf835bbf3e6b2967b8684159ca85b9d592d31c95 Mon Sep 17 00:00:00 2001 From: fred-boy Date: Thu, 19 Apr 2018 19:33:36 +0700 Subject: [PATCH] Less scale on android --- build.gradle | 4 +-- .../deadsoftware/cavecraft/InputHandler.java | 4 +-- .../cavecraft/game/GameInputHandler.java | 4 --- .../cavecraft/game/GameRenderer.java | 31 ++++++++----------- 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 268317d..a9fac5c 100644 --- a/build.gradle +++ b/build.gradle @@ -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 +} diff --git a/core/src/ru/deadsoftware/cavecraft/InputHandler.java b/core/src/ru/deadsoftware/cavecraft/InputHandler.java index 4ceb0f8..da3e9e4 100644 --- a/core/src/ru/deadsoftware/cavecraft/InputHandler.java +++ b/core/src/ru/deadsoftware/cavecraft/InputHandler.java @@ -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 diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameInputHandler.java b/core/src/ru/deadsoftware/cavecraft/game/GameInputHandler.java index 61b52e4..e8c31be 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameInputHandler.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameInputHandler.java @@ -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; diff --git a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java index f1e830d..e119487 100644 --- a/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java +++ b/core/src/ru/deadsoftware/cavecraft/game/GameRenderer.java @@ -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(); -- 2.29.2