suyu/src/android/app/src/main/java/dev/suyu/suyu_emu/features/settings/model/view/ButtonInputSetting.kt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
1.1 KiB
Kotlin
Raw Normal View History

// SPDX-FileCopyrightText: 2023 yuzu Emulator Project
2024-03-11 22:30:43 -04:00
// SPDX-FileCopyrightText: 2024 suyu Emulator Project
2024-03-05 03:42:40 -05:00
// SPDX-License-Identifier: GPL-2.0-or-later
2024-03-31 20:08:49 -04:00
package dev.suyu.suyu_emu.features.settings.model.view
2024-03-05 03:42:40 -05:00
import androidx.annotation.StringRes
2024-03-31 20:08:49 -04:00
import dev.suyu.suyu_emu.utils.ParamPackage
import dev.suyu.suyu_emu.features.input.NativeInput
import dev.suyu.suyu_emu.features.input.model.InputType
import dev.suyu.suyu_emu.features.input.model.NativeButton
2024-03-05 03:42:40 -05:00
class ButtonInputSetting(
override val playerIndex: Int,
val nativeButton: NativeButton,
@StringRes titleId: Int = 0,
titleString: String = ""
) : InputSetting(titleId, titleString) {
override val type = TYPE_INPUT
override val inputType = InputType.Button
override fun getSelectedValue(): String {
val params = NativeInput.getButtonParam(playerIndex, nativeButton)
val button = buttonToText(params)
return getDisplayString(params, button)
}
override fun setSelectedValue(param: ParamPackage) =
NativeInput.setButtonParam(playerIndex, nativeButton, param)
}