Adjust default OSC opacity and color

This commit is contained in:
lynxnb 2023-03-05 12:15:04 +01:00 committed by Niccolò Betto
parent 1282362fce
commit b724bc2309
4 changed files with 18 additions and 22 deletions

View File

@ -6,8 +6,8 @@
package emu.skyline.input.onscreen package emu.skyline.input.onscreen
import android.content.Context import android.content.Context
import android.graphics.Color
import emu.skyline.input.ButtonId import emu.skyline.input.ButtonId
import emu.skyline.utils.SwitchColors
import emu.skyline.utils.sharedPreferences import emu.skyline.utils.sharedPreferences
interface ControllerConfiguration { interface ControllerConfiguration {
@ -24,9 +24,9 @@ interface ControllerConfiguration {
* Dummy implementation so layout editor is able to render [OnScreenControllerView] when [android.view.View.isInEditMode] is true * Dummy implementation so layout editor is able to render [OnScreenControllerView] when [android.view.View.isInEditMode] is true
*/ */
class ControllerConfigurationDummy(defaultRelativeX : Float, defaultRelativeY : Float) : ControllerConfiguration { class ControllerConfigurationDummy(defaultRelativeX : Float, defaultRelativeY : Float) : ControllerConfiguration {
override var alpha : Int = 255 override var alpha : Int = 155
override var textColor = Color.argb(180, 0, 0, 0) override var textColor = SwitchColors.BLACK.color
override var backgroundColor = Color.argb(180, 255, 255, 255) override var backgroundColor = SwitchColors.WHITE.color
override var enabled = true override var enabled = true
override var globalScale = 1f override var globalScale = 1f
override var relativeX = defaultRelativeX override var relativeX = defaultRelativeX
@ -36,9 +36,9 @@ class ControllerConfigurationDummy(defaultRelativeX : Float, defaultRelativeY :
class ControllerConfigurationImpl(private val context : Context, private val buttonId : ButtonId, defaultRelativeX : Float, defaultRelativeY : Float) : ControllerConfiguration { class ControllerConfigurationImpl(private val context : Context, private val buttonId : ButtonId, defaultRelativeX : Float, defaultRelativeY : Float) : ControllerConfiguration {
private inline fun <reified T> config(default : T, prefix : String = "${buttonId.name}_") = sharedPreferences(context, default, prefix, "controller_config") private inline fun <reified T> config(default : T, prefix : String = "${buttonId.name}_") = sharedPreferences(context, default, prefix, "controller_config")
override var alpha by config(255, "") override var alpha by config(155, "")
override var textColor by config(Color.argb(180, 0, 0, 0)) override var textColor by config(SwitchColors.BLACK.color)
override var backgroundColor by config(Color.argb(180, 255, 255, 255)) override var backgroundColor by config(SwitchColors.WHITE.color)
override var enabled by config(true) override var enabled by config(true)
override var globalScale by config(1.15f, "") override var globalScale by config(1.15f, "")
override var relativeX by config(defaultRelativeX) override var relativeX by config(defaultRelativeX)

View File

@ -268,7 +268,7 @@ class OnScreenControllerView @JvmOverloads constructor(context : Context, attrs
it.config.enabled = true it.config.enabled = true
} }
controls.globalScale = 1.15f controls.globalScale = 1.15f
controls.alpha = 255 controls.alpha = 155
invalidate() invalidate()
} }

View File

@ -67,10 +67,6 @@ class JoystickButton(
var shortDoubleTapped = false var shortDoubleTapped = false
private set private set
init {
innerButton.buttonSymbolPaint.typeface = Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)
}
override fun renderCenteredText(canvas : Canvas, text : String, size : Float, x : Float, y : Float, alpha : Int) = Unit override fun renderCenteredText(canvas : Canvas, text : String, size : Float, x : Float, y : Float, alpha : Int) = Unit
override fun render(canvas : Canvas) { override fun render(canvas : Canvas) {

View File

@ -9,17 +9,17 @@ import android.graphics.Color
enum class SwitchColors(val color : Int) { enum class SwitchColors(val color : Int) {
GRAY(Color.GRAY), GRAY(Color.GRAY),
TRANSPARENT(Color.argb(180, 0, 0, 0)), BLACK(Color.rgb(0, 0, 0)),
WHITE(Color.argb(180, 255, 255, 255)), WHITE(Color.rgb(255, 255, 255)),
NEON_YELLOW(Color.argb(180, 230, 255, 0)), NEON_YELLOW(Color.rgb(230, 255, 0)),
NEON_PURPLE(Color.argb(180, 180, 0, 230)), NEON_PURPLE(Color.rgb(180, 0, 230)),
NEON_RED(Color.argb(180, 255, 60, 40)), NEON_RED(Color.rgb(255, 60, 40)),
MARIO_RED(Color.argb(180, 225, 15, 0)), MARIO_RED(Color.rgb(225, 15, 0)),
NEON_BLUE(Color.argb(180, 10, 185, 230)), NEON_BLUE(Color.rgb(10, 185, 230)),
BLUE(Color.argb(180, 70, 85, 245)), BLUE(Color.rgb(70, 85, 245)),
NEON_GREEN(Color.argb(180, 30, 220, 0)); NEON_GREEN(Color.rgb(30, 220, 0));
companion object { companion object {
val colors = SwitchColors.values().map { clr -> clr.color } val colors get() = SwitchColors.values().map { clr -> clr.color }
} }
} }