mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-22 14:59:15 +01:00
Draw a circle indicator on OSC buttons with toggle mode enabled
This commit is contained in:
parent
7cf45b11b0
commit
821cdb8d72
@ -40,6 +40,7 @@ abstract class OnScreenButton(
|
|||||||
const val CONFIGURED_ASPECT_RATIO = 2074f / 874f
|
const val CONFIGURED_ASPECT_RATIO = 2074f / 874f
|
||||||
|
|
||||||
private var disabledSelectionPaint : Paint? = null
|
private var disabledSelectionPaint : Paint? = null
|
||||||
|
private var toggleModePaint : Paint? = null
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@ -50,6 +51,13 @@ abstract class OnScreenButton(
|
|||||||
strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2f, onScreenControllerView.context.resources.displayMetrics)
|
strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2f, onScreenControllerView.context.resources.displayMetrics)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (toggleModePaint == null) {
|
||||||
|
toggleModePaint = Paint().apply {
|
||||||
|
style = Paint.Style.STROKE
|
||||||
|
strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2f, onScreenControllerView.context.resources.displayMetrics)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final override val config = OnScreenConfigurationImpl(onScreenControllerView.context, buttonId, defaultRelativeX, defaultRelativeY, defaultEnabled)
|
final override val config = OnScreenConfigurationImpl(onScreenControllerView.context, buttonId, defaultRelativeX, defaultRelativeY, defaultEnabled)
|
||||||
@ -158,6 +166,12 @@ abstract class OnScreenButton(
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderCenteredText(canvas, buttonId.short!!, itemWidth.coerceAtMost(itemHeight) * 0.4f, bounds.centerX().toFloat(), bounds.centerY().toFloat(), alpha)
|
renderCenteredText(canvas, buttonId.short!!, itemWidth.coerceAtMost(itemHeight) * 0.4f, bounds.centerX().toFloat(), bounds.centerY().toFloat(), alpha)
|
||||||
|
|
||||||
|
if (config.toggleMode) {
|
||||||
|
canvas.drawCircle(bounds.centerX().toFloat(), bounds.centerY().toFloat(), itemWidth.coerceAtMost(itemHeight) * 0.35f, toggleModePaint?.apply {
|
||||||
|
color = config.textColor
|
||||||
|
this.alpha = alpha
|
||||||
|
} ?: return)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user