Skip to content

Commit

Permalink
Fix compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Reco1I committed Dec 25, 2024
1 parent 5693ba3 commit 88dc64e
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 50 deletions.
12 changes: 1 addition & 11 deletions src/com/reco1l/andengine/ExtendedEntity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/com/reco1l/andengine/container/ConstraintContainer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/com/reco1l/osu/hitobjects/FollowPoints.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions src/com/reco1l/osu/hitobjects/SliderTicks.kt
Original file line number Diff line number Diff line change
@@ -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.*
Expand Down Expand Up @@ -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() {
Expand Down
17 changes: 8 additions & 9 deletions src/com/reco1l/osu/playfield/CirclePiece.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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.*

Expand All @@ -14,24 +15,22 @@ 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)
}

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)
Expand All @@ -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)
Expand Down
20 changes: 10 additions & 10 deletions src/com/reco1l/osu/playfield/CircularSongProgress.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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)
Expand All @@ -54,17 +54,17 @@ 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)
}

onMeasureContentSize()

setAnchor(Anchor.TopRight)
setOrigin(Anchor.CenterRight)
anchor = Anchor.TopRight
origin = Anchor.CenterRight
}


Expand Down
24 changes: 12 additions & 12 deletions src/com/reco1l/osu/playfield/Counters.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
Expand All @@ -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%"
Expand All @@ -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
Expand All @@ -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)

Expand All @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions src/com/reco1l/osu/playfield/HealthBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 88dc64e

Please sign in to comment.