Unify android ability wheel render logic
This commit is contained in:
parent
32f5b2ece9
commit
6cd050e0a7
@ -222,14 +222,14 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
event.poseStack.pushPose()
|
||||
event.poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0)
|
||||
|
||||
if (features.size == 1) {
|
||||
val feature = features.first()
|
||||
|
||||
feature.renderIcon(event.poseStack, -iconSizeSelected / 2f, -size * linearInterpolation(lastSelectProgress.getFloat(feature), 0.7f, 0.8f) - iconSizeSelected / 2f, iconSizeSelected, iconSizeSelected)
|
||||
} else {
|
||||
for ((index, feature) in features.withIndex()) {
|
||||
val sin = sin((index + 0.5) * degreePerSlice).toFloat()
|
||||
val cos = cos((index + 0.5) * degreePerSlice).toFloat()
|
||||
var sin = sin((index + 0.5) * degreePerSlice).toFloat()
|
||||
var cos = cos((index + 0.5) * degreePerSlice).toFloat()
|
||||
|
||||
if (features.size == 1) {
|
||||
sin = sin(PI / 2.0).toFloat()
|
||||
cos = cos(PI / 2.0).toFloat()
|
||||
}
|
||||
|
||||
val shift = size * 0.6f
|
||||
feature.renderIcon(event.poseStack, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize)
|
||||
@ -244,7 +244,6 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
||||
minecraft.font.drawAligned(event.poseStack, formatTickDuration(feature.cooldown), TextAlign.CENTER_CENTER, shift * cos, -shift * sin + iconSize / 1.5f, RGBAColor.WHITE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event.poseStack.popPose()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user