fixed a bug where ActorWithBody.mouseUp is incorrectly implemented

This commit is contained in:
minjaesong
2022-07-20 17:29:10 +09:00
parent de7ef60396
commit 0f4508986d
4 changed files with 12 additions and 2 deletions

View File

@@ -397,6 +397,10 @@ open class IngameInstance(val batch: FlippingSpriteBatch, val isMultiplayer: Boo
}
}
open fun getTooltipMessage(): String {
return uiTooltip.message
}
/**
* Copies most recent `save` to `save.1`, leaving `save` for overwriting, previous `save.1` will be copied to `save.2`
*/

View File

@@ -580,8 +580,13 @@ open class ActorWithBody : Actor {
feetPosPoint.set(hitbox.centeredX, hitbox.endY)
feetPosTile.set(hIntTilewiseHitbox.centeredX.floorInt(), hIntTilewiseHitbox.endY.floorInt())
if (mouseUp && this.tooltipText != null) INGAME.setTooltipMessage(this.tooltipText)
}
// make sure tooltip to disable even when the actor's update is paused at unfortunate time
if (!mouseUp && INGAME.getTooltipMessage() == this.tooltipText) INGAME.setTooltipMessage(null)
isStationary = (hitbox - oldHitbox).magnitudeSquared < PHYS_EPSILON_VELO
}

View File

@@ -158,7 +158,8 @@ class Hitbox {
return this
}
fun containsPoint(x: Double, y: Double) = (hitboxStart.x - x) in 0.0..width && (hitboxStart.y - y) in 0.0..height
// TODO consider ROUNDWORLD
fun containsPoint(x: Double, y: Double) = (x - hitboxStart.x) in 0.0..width && (y - hitboxStart.y) in 0.0..height
fun containsPoint(p: Point2d) = containsPoint(p.x, p.y)

View File

@@ -105,5 +105,5 @@ internal class FixtureTapestry : FixtureBase {
}
override var tooltipText: String? = "$artName\n$artAuthor"
override var tooltipText: String? = "TEST\nSTRING"//if (artName.length + artAuthor.length > 0) "$artName\n$artAuthor" else null
}