mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
musicplayer: actually repositioning the ui
This commit is contained in:
@@ -219,6 +219,8 @@ class MusicPlayer(private val ingame: TerrarumIngame) : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override val mouseUp: Boolean
|
||||||
|
get() = (relativeMouseX) in -capsuleMosaicSize until width+capsuleMosaicSize && relativeMouseY in 0 until height
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
batch.end()
|
batch.end()
|
||||||
@@ -226,13 +228,13 @@ class MusicPlayer(private val ingame: TerrarumIngame) : UICanvas() {
|
|||||||
batch.begin()
|
batch.begin()
|
||||||
|
|
||||||
|
|
||||||
val posX = ((Toolkit.drawWidth - width) / 2).toFloat()
|
posX = ((Toolkit.drawWidth - width) / 2)
|
||||||
val posY = (App.scr.height - App.scr.tvSafeGraphicsHeight - height).toFloat()
|
posY = (App.scr.height - App.scr.tvSafeGraphicsHeight - height)
|
||||||
|
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
drawBaloon(batch, posX, posY, width.toFloat(), height - capsuleHeight.toFloat())
|
drawBaloon(batch, 0f, 0f, width.toFloat(), height - capsuleHeight.toFloat())
|
||||||
drawText(batch, posX, posY)
|
drawText(batch, 0f, 0f)
|
||||||
drawFreqMeter(batch, posX + width - 18, posY + height - (capsuleHeight / 2) + 1)
|
drawFreqMeter(batch, width - 18f, height - (capsuleHeight / 2) + 1f)
|
||||||
|
|
||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
}
|
}
|
||||||
@@ -240,7 +242,7 @@ class MusicPlayer(private val ingame: TerrarumIngame) : UICanvas() {
|
|||||||
private fun drawBaloon(batch: SpriteBatch, x: Float, y: Float, width: Float, height: Float) {
|
private fun drawBaloon(batch: SpriteBatch, x: Float, y: Float, width: Float, height: Float) {
|
||||||
val x = x - capsuleMosaicSize
|
val x = x - capsuleMosaicSize
|
||||||
for (k in 0..3 step 3) {
|
for (k in 0..3 step 3) {
|
||||||
batch.color = if (k == 0) colourEdge else colourBack
|
batch.color = if (k == 0) colourEdge else colourBack// (if (mouseUp) Color.MAROON else colourBack)
|
||||||
|
|
||||||
// top left
|
// top left
|
||||||
batch.draw(baloonTexture.get(k, 0), x, y)
|
batch.draw(baloonTexture.get(k, 0), x, y)
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ abstract class UICanvas(
|
|||||||
get() = mouseUp && Terrarum.mouseDown
|
get() = mouseUp && Terrarum.mouseDown
|
||||||
|
|
||||||
private val _mouseUpThis: Boolean
|
private val _mouseUpThis: Boolean
|
||||||
get() = relativeMouseX in 0..width - 1 && relativeMouseY in 0..height - 1
|
get() = relativeMouseX in 0 until width && relativeMouseY in 0 until height
|
||||||
|
|
||||||
/** Called by the screen */
|
/** Called by the screen */
|
||||||
fun update(delta: Float) {
|
fun update(delta: Float) {
|
||||||
|
|||||||
Reference in New Issue
Block a user