From 2cbc6fad1185e88350313a980a3a7af4956773dd Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sat, 3 Feb 2024 19:20:20 +0900 Subject: [PATCH] noticelet to make way for the mouse cursor --- .../torvald/terrarum/modulebasegame/ui/Noticelet.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/net/torvald/terrarum/modulebasegame/ui/Noticelet.kt b/src/net/torvald/terrarum/modulebasegame/ui/Noticelet.kt index e1824bbdc..9a0afa41f 100644 --- a/src/net/torvald/terrarum/modulebasegame/ui/Noticelet.kt +++ b/src/net/torvald/terrarum/modulebasegame/ui/Noticelet.kt @@ -58,6 +58,10 @@ class Noticelet : UICanvas() { messageQueue.remove(it) } toDelete.clear() + + if (Terrarum.mouseScreenX.toFloat() in Toolkit.drawWidthf * 0.25f..Toolkit.drawWidthf * 0.75f) { + ypos = if (Terrarum.mouseScreenY < App.scr.halfhf) 1f else -1f + } } private val h = 24f @@ -65,12 +69,14 @@ class Noticelet : UICanvas() { private val toDelete = ArrayList() + private var ypos = 1f // 1: bottom, -1: top + override fun renderUI(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) { val px = Toolkit.drawWidthf - val py = App.scr.halfhf + 100f + val py = App.scr.halfhf + 120f * ypos - (if (ypos < 0) h else 0f) messageQueue.forEachIndexed { index, notice -> - drawNoticelet(batch, px, py + (h + gap) * index, notice) + drawNoticelet(batch, px, py + (h + gap) * index * ypos, notice) } }