Skip to content

Commit

Permalink
Added the keyboard icon for portrait mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanceewing committed Apr 28, 2024
1 parent f55234b commit e9273fc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions core/src/main/java/com/agifans/agile/GameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,9 @@ private void draw(float delta) {
batch.setColor(c.r, c.g, c.b, 0.5f);
if (viewportManager.isPortrait()) {
// Portrait
batch.draw(joystickIcon, 20, 20);
batch.draw(fullScreenIcon, viewportManager.getWidth() - viewportManager.getWidth() / 2 - 48, 20);
batch.draw(fullScreenIcon, 20, 20);
batch.draw(joystickIcon, (viewportManager.getWidth() / 3) - 32, 20);
batch.draw(keyboardIcon, (viewportManager.getWidth() - (viewportManager.getWidth() / 3)) - 64, 20);
batch.draw(backIcon, viewportManager.getWidth() - 116, 20);
} else {
// Landscape
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,17 @@ public boolean touchUp(int screenX, int screenY, int pointer, int button) {
// Portrait.
if (touchXY.y < 135) {
if (touchXY.x < 126) {
joystickClicked = true;
fullScreenClicked = true;
} else if (touchXY.x > (viewportManager.getWidth() - 126)) {
backArrowClicked = true;
} else {
int midWidth = (int) (viewportManager.getWidth() - (viewportManager.getWidth() / 2));
if ((touchXY.x > (midWidth - 63)) && (touchXY.x < (midWidth + 63))) {
fullScreenClicked = true;
float thirdPos = (viewportManager.getWidth() / 3);
float twoThirdPos = (viewportManager.getWidth() - (viewportManager.getWidth() / 3));
if ((touchXY.x > (thirdPos - 42)) && (touchXY.x < (thirdPos + 84))) {
joystickClicked = true;
}
else if ((touchXY.x > (twoThirdPos - 84)) && (touchXY.x < (twoThirdPos + 42))) {
keyboardClicked = true;
}
}
}
Expand Down

0 comments on commit e9273fc

Please sign in to comment.