mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
Removed seemingly redundant opacityId
value
This commit is contained in:
parent
d22afdb97f
commit
c9f6f6e40e
@ -36,7 +36,6 @@ class InputOverlayDrawableButton(
|
|||||||
private var controlPositionY = 0
|
private var controlPositionY = 0
|
||||||
val width: Int
|
val width: Int
|
||||||
val height: Int
|
val height: Int
|
||||||
private val opacityId: Int
|
|
||||||
private val defaultStateBitmap: BitmapDrawable
|
private val defaultStateBitmap: BitmapDrawable
|
||||||
private val pressedStateBitmap: BitmapDrawable
|
private val pressedStateBitmap: BitmapDrawable
|
||||||
private var pressedState = false
|
private var pressedState = false
|
||||||
@ -44,7 +43,6 @@ class InputOverlayDrawableButton(
|
|||||||
init {
|
init {
|
||||||
this.defaultStateBitmap = BitmapDrawable(res, defaultStateBitmap)
|
this.defaultStateBitmap = BitmapDrawable(res, defaultStateBitmap)
|
||||||
this.pressedStateBitmap = BitmapDrawable(res, pressedStateBitmap)
|
this.pressedStateBitmap = BitmapDrawable(res, pressedStateBitmap)
|
||||||
this.opacityId = this.opacity
|
|
||||||
trackId = -1
|
trackId = -1
|
||||||
width = this.defaultStateBitmap.intrinsicWidth
|
width = this.defaultStateBitmap.intrinsicWidth
|
||||||
height = this.defaultStateBitmap.intrinsicHeight
|
height = this.defaultStateBitmap.intrinsicHeight
|
||||||
@ -119,7 +117,7 @@ class InputOverlayDrawableButton(
|
|||||||
|
|
||||||
fun draw(canvas: Canvas) {
|
fun draw(canvas: Canvas) {
|
||||||
val bitmapDrawable: BitmapDrawable = currentStateBitmapDrawable
|
val bitmapDrawable: BitmapDrawable = currentStateBitmapDrawable
|
||||||
bitmapDrawable.alpha = opacityId
|
bitmapDrawable.alpha = opacity
|
||||||
bitmapDrawable.draw(canvas)
|
bitmapDrawable.draw(canvas)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ class InputOverlayDrawableDpad(
|
|||||||
private var controlPositionY = 0
|
private var controlPositionY = 0
|
||||||
val width: Int
|
val width: Int
|
||||||
val height: Int
|
val height: Int
|
||||||
private val opacityId: Int
|
|
||||||
private val defaultStateBitmap: BitmapDrawable
|
private val defaultStateBitmap: BitmapDrawable
|
||||||
private val pressedOneDirectionStateBitmap: BitmapDrawable
|
private val pressedOneDirectionStateBitmap: BitmapDrawable
|
||||||
private val pressedTwoDirectionsStateBitmap: BitmapDrawable
|
private val pressedTwoDirectionsStateBitmap: BitmapDrawable
|
||||||
@ -58,7 +57,6 @@ class InputOverlayDrawableDpad(
|
|||||||
this.defaultStateBitmap = BitmapDrawable(res, defaultStateBitmap)
|
this.defaultStateBitmap = BitmapDrawable(res, defaultStateBitmap)
|
||||||
this.pressedOneDirectionStateBitmap = BitmapDrawable(res, pressedOneDirectionStateBitmap)
|
this.pressedOneDirectionStateBitmap = BitmapDrawable(res, pressedOneDirectionStateBitmap)
|
||||||
this.pressedTwoDirectionsStateBitmap = BitmapDrawable(res, pressedTwoDirectionsStateBitmap)
|
this.pressedTwoDirectionsStateBitmap = BitmapDrawable(res, pressedTwoDirectionsStateBitmap)
|
||||||
this.opacityId = this.opacity
|
|
||||||
width = this.defaultStateBitmap.intrinsicWidth
|
width = this.defaultStateBitmap.intrinsicWidth
|
||||||
height = this.defaultStateBitmap.intrinsicHeight
|
height = this.defaultStateBitmap.intrinsicHeight
|
||||||
trackId = -1
|
trackId = -1
|
||||||
@ -141,7 +139,7 @@ class InputOverlayDrawableDpad(
|
|||||||
|
|
||||||
// Pressed up
|
// Pressed up
|
||||||
if (upButtonState && !leftButtonState && !rightButtonState) {
|
if (upButtonState && !leftButtonState && !rightButtonState) {
|
||||||
pressedOneDirectionStateBitmap.alpha = opacityId
|
pressedOneDirectionStateBitmap.alpha = opacity
|
||||||
pressedOneDirectionStateBitmap.draw(canvas)
|
pressedOneDirectionStateBitmap.draw(canvas)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -150,7 +148,7 @@ class InputOverlayDrawableDpad(
|
|||||||
if (downButtonState && !leftButtonState && !rightButtonState) {
|
if (downButtonState && !leftButtonState && !rightButtonState) {
|
||||||
canvas.save()
|
canvas.save()
|
||||||
canvas.rotate(180f, px.toFloat(), py.toFloat())
|
canvas.rotate(180f, px.toFloat(), py.toFloat())
|
||||||
pressedOneDirectionStateBitmap.alpha = opacityId
|
pressedOneDirectionStateBitmap.alpha = opacity
|
||||||
pressedOneDirectionStateBitmap.draw(canvas)
|
pressedOneDirectionStateBitmap.draw(canvas)
|
||||||
canvas.restore()
|
canvas.restore()
|
||||||
return
|
return
|
||||||
@ -160,7 +158,7 @@ class InputOverlayDrawableDpad(
|
|||||||
if (leftButtonState && !upButtonState && !downButtonState) {
|
if (leftButtonState && !upButtonState && !downButtonState) {
|
||||||
canvas.save()
|
canvas.save()
|
||||||
canvas.rotate(270f, px.toFloat(), py.toFloat())
|
canvas.rotate(270f, px.toFloat(), py.toFloat())
|
||||||
pressedOneDirectionStateBitmap.alpha = opacityId
|
pressedOneDirectionStateBitmap.alpha = opacity
|
||||||
pressedOneDirectionStateBitmap.draw(canvas)
|
pressedOneDirectionStateBitmap.draw(canvas)
|
||||||
canvas.restore()
|
canvas.restore()
|
||||||
return
|
return
|
||||||
@ -170,7 +168,7 @@ class InputOverlayDrawableDpad(
|
|||||||
if (rightButtonState && !upButtonState && !downButtonState) {
|
if (rightButtonState && !upButtonState && !downButtonState) {
|
||||||
canvas.save()
|
canvas.save()
|
||||||
canvas.rotate(90f, px.toFloat(), py.toFloat())
|
canvas.rotate(90f, px.toFloat(), py.toFloat())
|
||||||
pressedOneDirectionStateBitmap.alpha = opacityId
|
pressedOneDirectionStateBitmap.alpha = opacity
|
||||||
pressedOneDirectionStateBitmap.draw(canvas)
|
pressedOneDirectionStateBitmap.draw(canvas)
|
||||||
canvas.restore()
|
canvas.restore()
|
||||||
return
|
return
|
||||||
@ -178,7 +176,7 @@ class InputOverlayDrawableDpad(
|
|||||||
|
|
||||||
// Pressed up left
|
// Pressed up left
|
||||||
if (upButtonState && leftButtonState && !rightButtonState) {
|
if (upButtonState && leftButtonState && !rightButtonState) {
|
||||||
pressedTwoDirectionsStateBitmap.alpha = opacityId
|
pressedTwoDirectionsStateBitmap.alpha = opacity
|
||||||
pressedTwoDirectionsStateBitmap.draw(canvas)
|
pressedTwoDirectionsStateBitmap.draw(canvas)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -187,7 +185,7 @@ class InputOverlayDrawableDpad(
|
|||||||
if (upButtonState && !leftButtonState && rightButtonState) {
|
if (upButtonState && !leftButtonState && rightButtonState) {
|
||||||
canvas.save()
|
canvas.save()
|
||||||
canvas.rotate(90f, px.toFloat(), py.toFloat())
|
canvas.rotate(90f, px.toFloat(), py.toFloat())
|
||||||
pressedTwoDirectionsStateBitmap.alpha = opacityId
|
pressedTwoDirectionsStateBitmap.alpha = opacity
|
||||||
pressedTwoDirectionsStateBitmap.draw(canvas)
|
pressedTwoDirectionsStateBitmap.draw(canvas)
|
||||||
canvas.restore()
|
canvas.restore()
|
||||||
return
|
return
|
||||||
@ -197,7 +195,7 @@ class InputOverlayDrawableDpad(
|
|||||||
if (downButtonState && leftButtonState && !rightButtonState) {
|
if (downButtonState && leftButtonState && !rightButtonState) {
|
||||||
canvas.save()
|
canvas.save()
|
||||||
canvas.rotate(270f, px.toFloat(), py.toFloat())
|
canvas.rotate(270f, px.toFloat(), py.toFloat())
|
||||||
pressedTwoDirectionsStateBitmap.alpha = opacityId
|
pressedTwoDirectionsStateBitmap.alpha = opacity
|
||||||
pressedTwoDirectionsStateBitmap.draw(canvas)
|
pressedTwoDirectionsStateBitmap.draw(canvas)
|
||||||
canvas.restore()
|
canvas.restore()
|
||||||
return
|
return
|
||||||
@ -207,14 +205,14 @@ class InputOverlayDrawableDpad(
|
|||||||
if (downButtonState && !leftButtonState && rightButtonState) {
|
if (downButtonState && !leftButtonState && rightButtonState) {
|
||||||
canvas.save()
|
canvas.save()
|
||||||
canvas.rotate(180f, px.toFloat(), py.toFloat())
|
canvas.rotate(180f, px.toFloat(), py.toFloat())
|
||||||
pressedTwoDirectionsStateBitmap.alpha = opacityId
|
pressedTwoDirectionsStateBitmap.alpha = opacity
|
||||||
pressedTwoDirectionsStateBitmap.draw(canvas)
|
pressedTwoDirectionsStateBitmap.draw(canvas)
|
||||||
canvas.restore()
|
canvas.restore()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not pressed
|
// Not pressed
|
||||||
defaultStateBitmap.alpha = opacityId
|
defaultStateBitmap.alpha = opacity
|
||||||
defaultStateBitmap.draw(canvas)
|
defaultStateBitmap.draw(canvas)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ class InputOverlayDrawableJoystick(
|
|||||||
private var previousTouchY = 0
|
private var previousTouchY = 0
|
||||||
val width: Int
|
val width: Int
|
||||||
val height: Int
|
val height: Int
|
||||||
private val opacityId: Int
|
|
||||||
private var virtBounds: Rect
|
private var virtBounds: Rect
|
||||||
private var origBounds: Rect
|
private var origBounds: Rect
|
||||||
private val outerBitmap: BitmapDrawable
|
private val outerBitmap: BitmapDrawable
|
||||||
@ -75,7 +74,6 @@ class InputOverlayDrawableJoystick(
|
|||||||
width = bitmapOuter.width
|
width = bitmapOuter.width
|
||||||
height = bitmapOuter.height
|
height = bitmapOuter.height
|
||||||
bounds = rectOuter
|
bounds = rectOuter
|
||||||
opacityId = opacity
|
|
||||||
defaultStateInnerBitmap.bounds = rectInner
|
defaultStateInnerBitmap.bounds = rectInner
|
||||||
pressedStateInnerBitmap.bounds = rectInner
|
pressedStateInnerBitmap.bounds = rectInner
|
||||||
virtBounds = bounds
|
virtBounds = bounds
|
||||||
@ -90,7 +88,7 @@ class InputOverlayDrawableJoystick(
|
|||||||
|
|
||||||
fun draw(canvas: Canvas?) {
|
fun draw(canvas: Canvas?) {
|
||||||
outerBitmap.draw(canvas!!)
|
outerBitmap.draw(canvas!!)
|
||||||
currentStateBitmapDrawable.alpha = opacityId
|
currentStateBitmapDrawable.alpha = opacity
|
||||||
currentStateBitmapDrawable.draw(canvas)
|
currentStateBitmapDrawable.draw(canvas)
|
||||||
boundsBoxBitmap.draw(canvas)
|
boundsBoxBitmap.draw(canvas)
|
||||||
}
|
}
|
||||||
@ -111,7 +109,7 @@ class InputOverlayDrawableJoystick(
|
|||||||
}
|
}
|
||||||
pressedState = true
|
pressedState = true
|
||||||
outerBitmap.alpha = 0
|
outerBitmap.alpha = 0
|
||||||
boundsBoxBitmap.alpha = opacityId
|
boundsBoxBitmap.alpha = opacity
|
||||||
if (EmulationMenuSettings.joystickRelCenter) {
|
if (EmulationMenuSettings.joystickRelCenter) {
|
||||||
virtBounds.offset(
|
virtBounds.offset(
|
||||||
xPosition - virtBounds.centerX(),
|
xPosition - virtBounds.centerX(),
|
||||||
@ -131,7 +129,7 @@ class InputOverlayDrawableJoystick(
|
|||||||
yAxis = 0.0f
|
yAxis = 0.0f
|
||||||
angle = 0.0f
|
angle = 0.0f
|
||||||
radius = 0.0f
|
radius = 0.0f
|
||||||
outerBitmap.alpha = opacityId
|
outerBitmap.alpha = opacity
|
||||||
boundsBoxBitmap.alpha = 0
|
boundsBoxBitmap.alpha = 0
|
||||||
virtBounds = Rect(origBounds.left, origBounds.top, origBounds.right, origBounds.bottom)
|
virtBounds = Rect(origBounds.left, origBounds.top, origBounds.right, origBounds.bottom)
|
||||||
bounds = Rect(origBounds.left, origBounds.top, origBounds.right, origBounds.bottom)
|
bounds = Rect(origBounds.left, origBounds.top, origBounds.right, origBounds.bottom)
|
||||||
|
Loading…
Reference in New Issue
Block a user