Skip to content

Commit

Permalink
Made icons slightly smaller, to better support full screen landscape.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanceewing committed Mar 18, 2024
1 parent 55f32c4 commit 8e89649
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 25 deletions.
Binary file modified assets/png/back_arrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/png/full_screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/png/joystick_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/png/keyboard_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 11 additions & 12 deletions core/src/main/java/com/agifans/agile/GameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.agifans.agile.ui.GameScreenInputProcessor;
import com.agifans.agile.ui.KeyboardType;
import com.agifans.agile.ui.ViewportManager;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
Expand Down Expand Up @@ -115,8 +114,8 @@ public GameScreen(Agile agile, AgileRunner agileRunner, DialogHandler dialogHand
fullScreenIcon = new Texture("png/full_screen.png");

// Create the portrait and landscape joystick touchpads.
portraitTouchpad = createTouchpad(200, 1080 - 200 - 15, 1920);
landscapeTouchpad = createTouchpad(150, 1920 - 150 - 15, 815);
portraitTouchpad = createTouchpad(200, 1080 - 200, 1920);
landscapeTouchpad = createTouchpad(150, 1920 - 150, 815);

viewportManager = ViewportManager.getInstance();

Expand Down Expand Up @@ -289,14 +288,14 @@ private void draw(float delta) {

batch.setColor(c.r, c.g, c.b, 0.5f);
if (viewportManager.isPortrait()) {
batch.draw(joystickIcon, 0, 0);
batch.draw(fullScreenIcon, viewportManager.getWidth() - viewportManager.getWidth() / 2 - 70, 0);
batch.draw(backIcon, viewportManager.getWidth() - 145, 0);
batch.draw(joystickIcon, 4, 4);
batch.draw(fullScreenIcon, viewportManager.getWidth() - viewportManager.getWidth() / 2 - 48, 4);
batch.draw(backIcon, viewportManager.getWidth() - 98, 4);
} else {
batch.draw(joystickIcon, 0, viewportManager.getHeight() - 140);
batch.draw(fullScreenIcon, viewportManager.getWidth() - 150, viewportManager.getHeight() - 140);
batch.draw(backIcon, viewportManager.getWidth() - 150, 0);
batch.draw(keyboardIcon, 0, 0);
batch.draw(joystickIcon, 0, viewportManager.getHeight() - 100);
batch.draw(fullScreenIcon, viewportManager.getWidth() - 100, viewportManager.getHeight() - 100);
batch.draw(backIcon, viewportManager.getWidth() - 100, 4);
batch.draw(keyboardIcon, 4, 4);
}

batch.end();
Expand All @@ -306,9 +305,9 @@ private void draw(float delta) {
float joyX = 0;
float joyY = 0;
if (viewportManager.isPortrait()) {
// Top of keyboard is: 765 + 145 = 910. Touchpad is 200 high.
// Top of keyboard is: 765 + 120 = 910. Touchpad is 200 high.
int agiScreenBase = (int)(viewportManager.getHeight() - (viewportManager.getWidth() / 1.32));
int midBetweenKeybAndPic = ((agiScreenBase + 910) / 2);
int midBetweenKeybAndPic = ((agiScreenBase + 885) / 2);
portraitTouchpad.setY(midBetweenKeybAndPic - 100);
portraitTouchpadStage.act(delta);
portraitTouchpadStage.draw();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,31 +318,31 @@ public boolean touchUp(int screenX, int screenY, int pointer, int button) {

if (viewportManager.isPortrait()) {
// Portrait.
if (touchXY.y < 130) {
if (touchXY.x < 140) {
if (touchXY.y < 104) {
if (touchXY.x < 104) {
joystickClicked = true;
} else if (touchXY.x > (viewportManager.getWidth() - 145)) {
} else if (touchXY.x > (viewportManager.getWidth() - 104)) {
backArrowClicked = true;
} else {
int midWidth = (int) (viewportManager.getWidth() - viewportManager.getWidth() / 2);
if ((touchXY.x > (midWidth - 70)) && (touchXY.y < (midWidth + 70))) {
if ((touchXY.x > (midWidth - 52)) && (touchXY.y < (midWidth + 52))) {
fullScreenClicked = true;
}
}
}
} else {
// Landscape.
int screenTop = (int) viewportManager.getHeight();
if (touchXY.y > (screenTop - 140)) {
if (touchXY.x < 140) {
if (touchXY.y > (screenTop - 104)) {
if (touchXY.x < 104) {
joystickClicked = true;
} else if (touchXY.x > (viewportManager.getWidth() - 150)) {
} else if (touchXY.x > (viewportManager.getWidth() - 104)) {
fullScreenClicked = true;
}
} else if (touchXY.y < 140) {
if (touchXY.x > (viewportManager.getWidth() - 150)) {
} else if (touchXY.y < 104) {
if (touchXY.x > (viewportManager.getWidth() - 104)) {
backArrowClicked = true;
} else if (touchXY.x < 140) {
} else if (touchXY.x < 104) {
keyboardClicked = true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/com/agifans/agile/ui/KeyboardType.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public enum KeyboardType {
},
"png/portrait_keyboard_lowercase.png",
0.6f,
145,
120,
0,
1,
-1,
Expand All @@ -86,7 +86,7 @@ public enum KeyboardType {
},
"png/portrait_keyboard_uppercase.png",
0.6f,
145,
120,
0,
1,
-1,
Expand All @@ -102,7 +102,7 @@ public enum KeyboardType {
},
"png/portrait_keyboard_punc_numbers.png",
0.6f,
145,
120,
0,
1,
-1,
Expand Down

0 comments on commit 8e89649

Please sign in to comment.