diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt index c055c2e35..a13faf3c7 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt | |||
| @@ -352,7 +352,7 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : | |||
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | private fun addOverlayControls(layout: String) { | 354 | private fun addOverlayControls(layout: String) { |
| 355 | val windowSize = getSafeScreenSize(context) | 355 | val windowSize = getSafeScreenSize(context, Pair(measuredWidth, measuredHeight)) |
| 356 | if (preferences.getBoolean(Settings.PREF_BUTTON_A, true)) { | 356 | if (preferences.getBoolean(Settings.PREF_BUTTON_A, true)) { |
| 357 | overlayButtons.add( | 357 | overlayButtons.add( |
| 358 | initializeOverlayButton( | 358 | initializeOverlayButton( |
| @@ -593,7 +593,7 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : | |||
| 593 | } | 593 | } |
| 594 | 594 | ||
| 595 | private fun saveControlPosition(prefId: String, x: Int, y: Int, layout: String) { | 595 | private fun saveControlPosition(prefId: String, x: Int, y: Int, layout: String) { |
| 596 | val windowSize = getSafeScreenSize(context) | 596 | val windowSize = getSafeScreenSize(context, Pair(measuredWidth, measuredHeight)) |
| 597 | val min = windowSize.first | 597 | val min = windowSize.first |
| 598 | val max = windowSize.second | 598 | val max = windowSize.second |
| 599 | PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext).edit() | 599 | PreferenceManager.getDefaultSharedPreferences(YuzuApplication.appContext).edit() |
| @@ -968,14 +968,17 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : | |||
| 968 | * @return A pair of points, the first being the top left corner of the safe area, | 968 | * @return A pair of points, the first being the top left corner of the safe area, |
| 969 | * the second being the bottom right corner of the safe area | 969 | * the second being the bottom right corner of the safe area |
| 970 | */ | 970 | */ |
| 971 | private fun getSafeScreenSize(context: Context): Pair<Point, Point> { | 971 | private fun getSafeScreenSize( |
| 972 | context: Context, | ||
| 973 | screenSize: Pair<Int, Int> | ||
| 974 | ): Pair<Point, Point> { | ||
| 972 | // Get screen size | 975 | // Get screen size |
| 973 | val windowMetrics = WindowMetricsCalculator.getOrCreate() | 976 | val windowMetrics = WindowMetricsCalculator.getOrCreate() |
| 974 | .computeCurrentWindowMetrics(context as Activity) | 977 | .computeCurrentWindowMetrics(context as Activity) |
| 975 | var maxY = windowMetrics.bounds.height().toFloat() | 978 | var maxX = screenSize.first.toFloat() |
| 976 | var maxX = windowMetrics.bounds.width().toFloat() | 979 | var maxY = screenSize.second.toFloat() |
| 977 | var minY = 0 | ||
| 978 | var minX = 0 | 980 | var minX = 0 |
| 981 | var minY = 0 | ||
| 979 | 982 | ||
| 980 | // If we have API access, calculate the safe area to draw the overlay | 983 | // If we have API access, calculate the safe area to draw the overlay |
| 981 | var cutoutLeft = 0 | 984 | var cutoutLeft = 0 |