mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-18 10:25:19 +01:00
Hide control panels in landscape mode when title screen is visible
This commit is contained in:
parent
212e52aea8
commit
ff1a0edd2f
2 changed files with 28 additions and 14 deletions
|
@ -297,8 +297,6 @@ class TitleScreen @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
override fun onTouchEvent(event: MotionEvent): Boolean {
|
||||
val isLandscape = resources.configuration.orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE
|
||||
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
startX = event.x
|
||||
|
@ -308,22 +306,18 @@ class TitleScreen @JvmOverloads constructor(
|
|||
return true
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
// Skip tetromino movement in landscape mode
|
||||
if (!isLandscape) {
|
||||
val deltaX = event.x - lastTouchX
|
||||
val deltaY = event.y - lastTouchY
|
||||
|
||||
// Update tetromino positions
|
||||
for (tetromino in tetrominos) {
|
||||
tetromino.x += deltaX * 0.5f
|
||||
tetromino.y += deltaY * 0.5f
|
||||
}
|
||||
|
||||
invalidate()
|
||||
val deltaX = event.x - lastTouchX
|
||||
val deltaY = event.y - lastTouchY
|
||||
|
||||
// Update tetromino positions
|
||||
for (tetromino in tetrominos) {
|
||||
tetromino.x += deltaX * 0.5f
|
||||
tetromino.y += deltaY * 0.5f
|
||||
}
|
||||
|
||||
lastTouchX = event.x
|
||||
lastTouchY = event.y
|
||||
invalidate()
|
||||
return true
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue