yuzu-emu
/
yuzu-mainline
Archived
1
0
Fork 0

android: Add DPad slide toggle

This commit is contained in:
Charles Lombardo 2023-04-04 13:15:27 -04:00 committed by bunnei
parent bebc822334
commit fcbf08ca98
5 changed files with 14 additions and 2 deletions

View File

@ -223,6 +223,7 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
popup.menuInflater.inflate(R.menu.menu_overlay_options, popup.menu) popup.menuInflater.inflate(R.menu.menu_overlay_options, popup.menu)
popup.menu.findItem(R.id.menu_rel_stick_center).isChecked = EmulationMenuSettings.joystickRelCenter popup.menu.findItem(R.id.menu_rel_stick_center).isChecked = EmulationMenuSettings.joystickRelCenter
popup.menu.findItem(R.id.menu_dpad_slide).isChecked = EmulationMenuSettings.dpadSlide
popup.setOnMenuItemClickListener { popup.setOnMenuItemClickListener {
when (it.itemId) { when (it.itemId) {
@ -266,6 +267,11 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback {
EmulationMenuSettings.joystickRelCenter = it.isChecked EmulationMenuSettings.joystickRelCenter = it.isChecked
true true
} }
R.id.menu_dpad_slide -> {
it.isChecked = !it.isChecked
EmulationMenuSettings.dpadSlide = it.isChecked
true
}
R.id.menu_reset_overlay -> { R.id.menu_reset_overlay -> {
binding.drawerLayout.close() binding.drawerLayout.close()
resetInputOverlay() resetInputOverlay()

View File

@ -127,7 +127,7 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : SurfaceView(context
} }
for (dpad in overlayDpads) { for (dpad in overlayDpads) {
if (!dpad.updateStatus(event, EmulationMenuSettings.dpadSlideEnable)) { if (!dpad.updateStatus(event, EmulationMenuSettings.dpadSlide)) {
continue continue
} }
NativeLibrary.onGamePadButtonEvent( NativeLibrary.onGamePadButtonEvent(

View File

@ -26,7 +26,7 @@ object EmulationMenuSettings {
.putBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, value) .putBoolean(Settings.PREF_MENU_SETTINGS_JOYSTICK_REL_CENTER, value)
.apply() .apply()
} }
var dpadSlideEnable: Boolean var dpadSlide: Boolean
get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, true) get() = preferences.getBoolean(Settings.PREF_MENU_SETTINGS_DPAD_SLIDE, true)
set(value) { set(value) {
preferences.edit() preferences.edit()

View File

@ -14,6 +14,11 @@
android:title="@string/emulation_rel_stick_center" android:title="@string/emulation_rel_stick_center"
android:checkable="true" /> android:checkable="true" />
<item
android:id="@+id/menu_dpad_slide"
android:title="@string/emulation_dpad_slide"
android:checkable="true" />
<item <item
android:id="@+id/menu_reset_overlay" android:id="@+id/menu_reset_overlay"
android:title="@string/emulation_touch_overlay_reset" /> android:title="@string/emulation_touch_overlay_reset" />

View File

@ -88,6 +88,7 @@
<string name="emulation_done">Done</string> <string name="emulation_done">Done</string>
<string name="emulation_toggle_controls">Toggle Controls</string> <string name="emulation_toggle_controls">Toggle Controls</string>
<string name="emulation_rel_stick_center">Relative Stick Center</string> <string name="emulation_rel_stick_center">Relative Stick Center</string>
<string name="emulation_dpad_slide">DPad Slide</string>
<string name="emulation_toggle_all">Toggle All</string> <string name="emulation_toggle_all">Toggle All</string>
<string name="emulation_control_scale">Adjust Scale</string> <string name="emulation_control_scale">Adjust Scale</string>
<string name="emulation_touch_overlay_reset">Reset Overlay</string> <string name="emulation_touch_overlay_reset">Reset Overlay</string>