diff --git a/src/com/reco1l/andengine/ExtendedEntity.kt b/src/com/reco1l/andengine/ExtendedEntity.kt index 2dde6a853..9c5216e6c 100644 --- a/src/com/reco1l/andengine/ExtendedEntity.kt +++ b/src/com/reco1l/andengine/ExtendedEntity.kt @@ -312,16 +312,6 @@ abstract class ExtendedEntity( // Positions - open fun setAnchor(value: Vector2): ExtendedEntity { - anchor = value - return this - } - - open fun setOrigin(value: Vector2): ExtendedEntity { - origin = value - return this - } - fun setRelativePosition(x: Float, y: Float) { relativePositionAxes = Axes.Both setPosition(x, y) @@ -855,7 +845,7 @@ val ExtendedEntity.anchorOffsetY: Float * The offset applied to the X axis according to the origin factor. */ val ExtendedEntity.originOffsetX: Float - get() = -(drawWidth * origin.y) + get() = -(drawWidth * origin.x) /** * The offset applied to the Y axis according to the origin factor. diff --git a/src/com/reco1l/andengine/container/ConstraintContainer.kt b/src/com/reco1l/andengine/container/ConstraintContainer.kt index e13699c94..31d7f6f04 100644 --- a/src/com/reco1l/andengine/container/ConstraintContainer.kt +++ b/src/com/reco1l/andengine/container/ConstraintContainer.kt @@ -20,7 +20,7 @@ class ConstraintContainer : Container() { val target = constraints[child] ?: this val targetX = target.getDrawX() - val anchorOffsetX = target.getDrawWidth() * child.anchorX + val anchorOffsetX = target.getDrawWidth() * child.anchor.x var childX = child.x @@ -38,7 +38,7 @@ class ConstraintContainer : Container() { val target = constraints[child] ?: this val targetY = target.getDrawY() - val anchorOffsetY = target.getDrawHeight() * child.anchorY + val anchorOffsetY = target.getDrawHeight() * child.anchor.y var childY = child.y diff --git a/src/com/reco1l/osu/hitobjects/FollowPoints.kt b/src/com/reco1l/osu/hitobjects/FollowPoints.kt index 81d604db1..b604d6666 100644 --- a/src/com/reco1l/osu/hitobjects/FollowPoints.kt +++ b/src/com/reco1l/osu/hitobjects/FollowPoints.kt @@ -117,8 +117,8 @@ object FollowPointConnection { fp.clearEntityModifiers() fp.setPosition(pointStartX, pointStartY) - fp.setOrigin(Anchor.Center) fp.setScale(1.5f * scale) + fp.origin = Anchor.Center fp.rotation = rotation fp.alpha = 0f diff --git a/src/com/reco1l/osu/hitobjects/SliderTicks.kt b/src/com/reco1l/osu/hitobjects/SliderTicks.kt index 1b852a846..a87ac6d91 100644 --- a/src/com/reco1l/osu/hitobjects/SliderTicks.kt +++ b/src/com/reco1l/osu/hitobjects/SliderTicks.kt @@ -1,5 +1,6 @@ package com.reco1l.osu.hitobjects +import com.reco1l.andengine.Anchor import com.reco1l.andengine.container.* import com.reco1l.andengine.sprite.* import com.reco1l.framework.* @@ -43,8 +44,7 @@ class SliderTickSprite : ExtendedSprite() { init { textureRegion = ResourceManager.getInstance().getTexture("sliderscorepoint") - originX = 0.5f - originY = 0.5f + origin = Anchor.Center } override fun onDetached() { diff --git a/src/com/reco1l/osu/playfield/CirclePiece.kt b/src/com/reco1l/osu/playfield/CirclePiece.kt index b58a6d4c2..48c3d9afe 100644 --- a/src/com/reco1l/osu/playfield/CirclePiece.kt +++ b/src/com/reco1l/osu/playfield/CirclePiece.kt @@ -3,6 +3,7 @@ package com.reco1l.osu.playfield import com.reco1l.andengine.* import com.reco1l.andengine.container.* import com.reco1l.andengine.sprite.* +import com.rian.osu.math.Vector2 import ru.nsu.ccfit.zuev.osu.* import ru.nsu.ccfit.zuev.skins.* @@ -14,15 +15,13 @@ open class CirclePiece( ) : Container() { - override var originX = 0.5f - - override var originY = 0.5f + override var origin = Anchor.Center private val circle = ExtendedSprite().also { - it.setOrigin(Anchor.Center) - it.setAnchor(Anchor.Center) + it.origin = Anchor.Center + it.anchor = Anchor.Center it.textureRegion = ResourceManager.getInstance().getTexture(circleTexture) attachChild(it) @@ -30,8 +29,8 @@ open class CirclePiece( private val overlay = ExtendedSprite().also { - it.setOrigin(Anchor.Center) - it.setAnchor(Anchor.Center) + it.origin = Anchor.Center + it.anchor = Anchor.Center it.textureRegion = ResourceManager.getInstance().getTexture(overlayTexture) attachChild(it) @@ -48,8 +47,8 @@ class NumberedCirclePiece(circleTexture: String, overlayTexture: String) : Circl private val number = SpriteFont(OsuSkin.get().hitCirclePrefix).also { - it.setOrigin(Anchor.Center) - it.setAnchor(Anchor.Center) + it.origin = Anchor.Center + it.anchor = Anchor.Center it.spacing = -OsuSkin.get().hitCircleOverlap attachChild(it) diff --git a/src/com/reco1l/osu/playfield/CircularSongProgress.kt b/src/com/reco1l/osu/playfield/CircularSongProgress.kt index d955ab748..1da0373e3 100644 --- a/src/com/reco1l/osu/playfield/CircularSongProgress.kt +++ b/src/com/reco1l/osu/playfield/CircularSongProgress.kt @@ -21,8 +21,8 @@ class CircularSongProgress : Container() { Circle().also { clear -> clear.setSize(30f, 30f) - clear.setAnchor(Anchor.Center) - clear.setOrigin(Anchor.Center) + clear.anchor = Anchor.Center + clear.origin = Anchor.Center clear.color = ColorARGB.Transparent clear.depthInfo = DepthInfo.Clear @@ -32,8 +32,8 @@ class CircularSongProgress : Container() { Circle().also { background -> background.setSize(33f, 33f) - background.setAnchor(Anchor.Center) - background.setOrigin(Anchor.Center) + background.anchor = Anchor.Center + background.origin = Anchor.Center background.color = ColorARGB.White background.depthInfo = DepthInfo.Default @@ -43,8 +43,8 @@ class CircularSongProgress : Container() { circularProgress = Circle().also { progress -> progress.setSize(30f, 30f) - progress.setAnchor(Anchor.Center) - progress.setOrigin(Anchor.Center) + progress.anchor = Anchor.Center + progress.origin = Anchor.Center progress.alpha = 0.6f attachChild(progress) @@ -54,8 +54,8 @@ class CircularSongProgress : Container() { Circle().also { dot -> dot.setSize(4f, 4f) - dot.setAnchor(Anchor.Center) - dot.setOrigin(Anchor.Center) + dot.anchor = Anchor.Center + dot.origin = Anchor.Center dot.color = ColorARGB.White attachChild(dot) @@ -63,8 +63,8 @@ class CircularSongProgress : Container() { onMeasureContentSize() - setAnchor(Anchor.TopRight) - setOrigin(Anchor.CenterRight) + anchor = Anchor.TopRight + origin = Anchor.CenterRight } diff --git a/src/com/reco1l/osu/playfield/Counters.kt b/src/com/reco1l/osu/playfield/Counters.kt index 3d9e15cde..aa3aa380a 100644 --- a/src/com/reco1l/osu/playfield/Counters.kt +++ b/src/com/reco1l/osu/playfield/Counters.kt @@ -17,8 +17,8 @@ class ScoreCounter : SpriteFont(OsuSkin.get().scorePrefix) { init { - setAnchor(Anchor.TopRight) - setOrigin(Anchor.TopRight) + anchor = Anchor.TopRight + origin = Anchor.TopRight setScale(0.96f) x = -10f @@ -35,8 +35,8 @@ class ScoreCounter : SpriteFont(OsuSkin.get().scorePrefix) { class PPCounter(private val algorithm: DifficultyAlgorithm) : SpriteFont(OsuSkin.get().scorePrefix) { init { - setAnchor(Anchor.TopRight) - setOrigin(Anchor.TopRight) + anchor = Anchor.TopRight + origin = Anchor.TopRight setScale(0.6f * 0.96f) setValue(0.0) } @@ -55,8 +55,8 @@ class AccuracyCounter : SpriteFont(OsuSkin.get().scorePrefix) { init { - setAnchor(Anchor.TopRight) - setOrigin(Anchor.TopRight) + anchor = Anchor.TopRight + origin = Anchor.TopRight setScale(0.6f * 0.96f) setPosition(-17f, 9f) text = "100.00%" @@ -77,8 +77,8 @@ class ComboCounter : Container() { it.alpha = 0f it.text = "0x" - it.setAnchor(Anchor.BottomLeft) - it.setOrigin(Anchor.BottomLeft) + it.anchor = Anchor.BottomLeft + it.origin = Anchor.BottomLeft // In stable, the bigger pop out scales a bit to the left it.translationX = -3f @@ -94,8 +94,8 @@ class ComboCounter : Container() { private val displayedCountTextSprite = SpriteFont(OsuSkin.get().comboPrefix).also { it.text = "0x" - it.setAnchor(Anchor.BottomLeft) - it.setOrigin(Anchor.BottomLeft) + it.anchor = Anchor.BottomLeft + it.origin = Anchor.BottomLeft it.translationY = -(FONT_HEIGHT_RATIO * it.drawHeight + VERTICAL_OFFSET) @@ -114,8 +114,8 @@ class ComboCounter : Container() { init { - setAnchor(Anchor.BottomLeft) - setOrigin(Anchor.BottomLeft) + anchor = Anchor.BottomLeft + origin = Anchor.BottomLeft setPosition(10f, -10f) setScale(1.28f) } diff --git a/src/com/reco1l/osu/playfield/HealthBar.kt b/src/com/reco1l/osu/playfield/HealthBar.kt index 31849ed08..37f74bce9 100644 --- a/src/com/reco1l/osu/playfield/HealthBar.kt +++ b/src/com/reco1l/osu/playfield/HealthBar.kt @@ -49,7 +49,7 @@ class HealthBar(private val statistics: StatisticV2) : Container() { attachChild(ExtendedSprite().apply { textureRegion = backgroundTexture }) fillClear = Box() - fillClear.setOrigin(Anchor.TopRight) + fillClear.origin = Anchor.TopRight fillClear.depthInfo = DepthInfo.Clear fillClear.alpha = 0f attachChild(fillClear) @@ -60,11 +60,11 @@ class HealthBar(private val statistics: StatisticV2) : Container() { attachChild(fill) marker = ExtendedSprite() - marker.setOrigin(Anchor.Center) + marker.origin = Anchor.Center attachChild(marker) explode = ExtendedSprite() - explode.setOrigin(Anchor.Center) + explode.origin = Anchor.Center explode.blendingFunction = BlendingFunction.Additive explode.alpha = 0f attachChild(explode)