Skip to content

Commit

Permalink
For landscape mode, adjust size of joystick knob dynamically when req…
Browse files Browse the repository at this point in the history
…uired.
  • Loading branch information
lanceewing committed Mar 20, 2024
1 parent fedca27 commit cab3982
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/com/agifans/agile/GameScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,10 @@ private void draw(float delta) {
int extraWidth = (int)(viewportManager.getWidth() - (viewportManager.getHeight() * 1.32));
int blackStripWidth = extraWidth / 2;
//System.out.println("blackStripWidth: " + blackStripWidth);
int joyWidth = Math.min(blackStripWidth - 32, 200);
int joyWidth = Math.min(Math.max(blackStripWidth - 32, 96), 200);
landscapeTouchpad.setSize(joyWidth, joyWidth);
landscapeTouchpad.getStyle().knob.setMinHeight(joyWidth * 0.6f);
landscapeTouchpad.getStyle().knob.setMinWidth(joyWidth * 0.6f);
landscapeTouchpad.setY(viewportManager.getHeight() - (viewportManager.getHeight() / 2) - (joyWidth / 2));
switch (gameScreenInputProcessor.getJoystickAlignment()) {
case OFF:
Expand Down

0 comments on commit cab3982

Please sign in to comment.