mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
implementation of Pie Menu
Former-commit-id: 0ff65782d25f0bf73435d297cf70d93e80882090 Former-commit-id: c31e1675890bb098addd2467f1137cb20038ec7d
This commit is contained in:
@@ -28,7 +28,9 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
|
||||
override var openCloseTime: Int = OPEN_CLOSE_TIME
|
||||
|
||||
internal var opacity = 0f
|
||||
internal var openCloseCounter = 0
|
||||
override var openCloseTimer = 0
|
||||
|
||||
override var handler: UIHandler? = null
|
||||
|
||||
private lateinit var uidrawCanvas: Image // render all the images and fonts here; will be faded
|
||||
|
||||
@@ -85,27 +87,27 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
|
||||
}
|
||||
|
||||
override fun doOpening(gc: GameContainer, delta: Int) {
|
||||
openCloseCounter += delta
|
||||
opacity = FastMath.interpolateLinear(openCloseCounter.toFloat() / openCloseTime.toFloat(),
|
||||
openCloseTimer += delta
|
||||
opacity = FastMath.interpolateLinear(openCloseTimer.toFloat() / openCloseTime.toFloat(),
|
||||
0f, 1f
|
||||
)
|
||||
}
|
||||
|
||||
override fun doClosing(gc: GameContainer, delta: Int) {
|
||||
openCloseCounter += delta
|
||||
opacity = FastMath.interpolateLinear(openCloseCounter.toFloat() / openCloseTime.toFloat(),
|
||||
openCloseTimer += delta
|
||||
opacity = FastMath.interpolateLinear(openCloseTimer.toFloat() / openCloseTime.toFloat(),
|
||||
1f, 0f
|
||||
)
|
||||
}
|
||||
|
||||
override fun endOpening(gc: GameContainer, delta: Int) {
|
||||
opacity = 1f
|
||||
openCloseCounter = 0
|
||||
openCloseTimer = 0
|
||||
}
|
||||
|
||||
override fun endClosing(gc: GameContainer, delta: Int) {
|
||||
opacity = 0f
|
||||
openCloseCounter = 0
|
||||
openCloseTimer = 0
|
||||
}
|
||||
|
||||
private fun drawSegments(g: Graphics) {
|
||||
|
||||
Reference in New Issue
Block a user