diff options
| author | Markus Wick <degasus@users.noreply.github.com> | 2016-09-19 22:15:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-19 22:15:19 +0200 |
| commit | 35ec7e3fc1e52ac9aaf3c515d387815cbf5558cb (patch) | |
| tree | 290499aba461add79ee79673ef9ff581613e3ac2 /Source/Android/app/src/main/java | |
| parent | 26bb01217803c238ffb61be200ee28c008016ba9 (diff) | |
| parent | 9d54c472ae3d432673be53471096672902c74a26 (diff) | |
Merge pull request #4222 from SeannyM/android-portrait-scale
Android: scale buttons based on smaller screen dimension
Diffstat (limited to 'Source/Android/app/src/main/java')
| -rw-r--r-- | Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java index 6c9601f5bb..377c8f330d 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/overlay/InputOverlay.java @@ -54,12 +54,14 @@ public final class InputOverlay extends SurfaceView implements OnTouchListener */ public static Bitmap resizeBitmap(Context context, Bitmap bitmap, float scale) { - // Retrieve screen dimensions. + // Determine the button size based on the smaller screen dimension. + // This makes sure the buttons are the same size in both portrait and landscape. DisplayMetrics dm = context.getResources().getDisplayMetrics(); + int minDimension = Math.min(dm.widthPixels, dm.heightPixels); return Bitmap.createScaledBitmap(bitmap, - (int)(dm.heightPixels * scale), - (int)(dm.heightPixels * scale), + (int)(minDimension * scale), + (int)(minDimension * scale), true); } |
