diff --git a/core/src/main/java/com/agifans/agile/GameScreen.java b/core/src/main/java/com/agifans/agile/GameScreen.java index f6d0362..65d332b 100644 --- a/core/src/main/java/com/agifans/agile/GameScreen.java +++ b/core/src/main/java/com/agifans/agile/GameScreen.java @@ -274,19 +274,19 @@ private void draw(float delta) { false, false); batch.end(); - // Render the UI elements, e.g. the keyboard and joystick icons. + // Now render the UI elements, e.g. the keyboard, full screen, and joystick icons. viewportManager.getCurrentCamera().update(); batch.setProjectionMatrix(viewportManager.getCurrentCamera().combined); batch.enableBlending(); batch.begin(); + // The keyboard is always render in portrait mode, as there is space for it, + // but in landscape mode, it needs to be enabled via the keyboard icon. if (keyboardType.isRendered() || viewportManager.isPortrait()) { batch.setColor(c.r, c.g, c.b, keyboardType.getOpacity()); batch.draw(keyboardType.getTexture(), 0, keyboardType.getRenderOffset()); } - // The keyboard and joystick icons are rendered only when an input type isn't - // showing. batch.setColor(c.r, c.g, c.b, 0.5f); if (viewportManager.isPortrait()) { batch.draw(joystickIcon, 0, 0); @@ -301,11 +301,15 @@ private void draw(float delta) { batch.end(); + // The joystick touch pad is updated and rendered via the Stage. if (gameScreenInputProcessor.isJoystickActive()) { float joyX = 0; float joyY = 0; if (viewportManager.isPortrait()) { - portraitTouchpad.setY(viewportManager.getHeight() - 1050); + // Top of keyboard is: 765 + 145 = 910. Touchpad is 200 high. + int agiScreenBase = (int)(viewportManager.getHeight() - (viewportManager.getWidth() / 1.32)); + int midBetweenKeybAndPic = ((agiScreenBase + 910) / 2); + portraitTouchpad.setY(midBetweenKeybAndPic - 100); portraitTouchpadStage.act(delta); portraitTouchpadStage.draw(); joyX = portraitTouchpad.getKnobPercentX(); diff --git a/core/src/main/java/com/agifans/agile/ui/GameScreenInputProcessor.java b/core/src/main/java/com/agifans/agile/ui/GameScreenInputProcessor.java index f3f5736..b0befea 100644 --- a/core/src/main/java/com/agifans/agile/ui/GameScreenInputProcessor.java +++ b/core/src/main/java/com/agifans/agile/ui/GameScreenInputProcessor.java @@ -2,7 +2,6 @@ import com.agifans.agile.GameScreen; import com.agifans.agile.UserInput; -import com.badlogic.gdx.Application.ApplicationType; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Graphics; import com.badlogic.gdx.Input.Keys; @@ -118,7 +117,7 @@ public GameScreenInputProcessor(GameScreen gameScreen, DialogHandler dialogHandl public boolean touchDown(int screenX, int screenY, int pointer, int button) { // Convert the screen coordinates to world coordinates. Vector2 touchXY = viewportManager.unproject(screenX, screenY); - + // Update AGI mouse variables. updateAGIMouse(touchXY, button, true);