mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
feat(input): portrait pad under the game, kit-aware editor reset and leaner controller settings
This commit is contained in:
1 parent
0fba656ee2
commit
40665bbb1a
140 files changed
+1059
-2321
No files matched your search
@@ -69,8 +69,18 @@ object SessionDisplay {
|
||||
|
||||
const val UNFOLDED_MIN_DP = 600
|
||||
|
||||
fun unfoldedGameHeight(width: Int, height: Int, tabRow: Int = 0): Int =
|
||||
(minOf(width * 9 / 16, (height * UNFOLDED_MAX_GAME_SHARE).toInt()) - tabRow.coerceAtLeast(0)).coerceAtLeast(0) and 1.inv()
|
||||
/**
|
||||
* The game's share of a screen with the controls below it, at the game's [aspect] across the full width. A tab row under the bar
|
||||
* comes out of the controls while they keep [UNFOLDED_MIN_CONTROLS_SHARE] of the screen, and out of the game otherwise.
|
||||
*/
|
||||
fun unfoldedGameHeight(width: Int, height: Int, tabRow: Int = 0, aspect: Float = 16f / 9f): Int {
|
||||
val game = minOf((width / aspect.coerceAtLeast(.5f)).toInt(), (height * UNFOLDED_MAX_GAME_SHARE).toInt())
|
||||
val tabs = tabRow.coerceAtLeast(0)
|
||||
val roomy = height - game - tabs >= height * UNFOLDED_MIN_CONTROLS_SHARE
|
||||
return (if (roomy) game else game - tabs).coerceAtLeast(0) and 1.inv()
|
||||
}
|
||||
|
||||
const val UNFOLDED_MIN_CONTROLS_SHARE = .45f
|
||||
|
||||
fun unfoldedControlsWanted(
|
||||
enabled: Boolean,
|
||||
|
||||
@@ -1916,7 +1916,7 @@ object SessionPrefs {
|
||||
prefs(context).edit().putBoolean("pipAutoEnter", enabled).apply()
|
||||
}
|
||||
|
||||
fun unfoldedControls(context: Context): Boolean = prefs(context).getBoolean("unfoldedControls", false)
|
||||
fun unfoldedControls(context: Context): Boolean = prefs(context).getBoolean("unfoldedControls", true)
|
||||
|
||||
fun controlsBelowWanted(context: Context, mode: String, width: Int, height: Int, pip: Boolean = false): Boolean =
|
||||
SessionDisplay.unfoldedControlsWanted(
|
||||
|
||||
Reference in new issue
Block a user