diff --git a/core/src/com/unciv/ui/worldscreen/BackgroundActor.kt b/core/src/com/unciv/ui/worldscreen/BackgroundActor.kt index 2b8e37c1d8..4c10ac540f 100644 --- a/core/src/com/unciv/ui/worldscreen/BackgroundActor.kt +++ b/core/src/com/unciv/ui/worldscreen/BackgroundActor.kt @@ -1,8 +1,6 @@ package com.unciv.ui.worldscreen -import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.g2d.Batch -import com.badlogic.gdx.graphics.g2d.NinePatch import com.badlogic.gdx.scenes.scene2d.Actor import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.utils.Drawable @@ -11,7 +9,7 @@ import com.badlogic.gdx.utils.Align import com.unciv.ui.images.ImageGetter /** An Actor that just draws a Drawable [background], preferably a [NinePatchDrawable] created - * by [BackgroundActor.getRoundedEdgeRectangle], meant to work in Table Cells and to be overlaid with other Widgets. + * by [ImageGetter.getRoundedEdgeRectangle], meant to work in Table Cells and to be overlaid with other Widgets. * The drawable's center can be moved to any of the corners or vertex centers using `align`, which will also scale the * drawable up by factor 2 and clip to the original rectangle. This can be used to draw rectangles with one or two rounded corners. * @param align An [Align] constant - In which corner of the [BackgroundActor] rectangle the center of the [background] should be. @@ -49,13 +47,4 @@ class BackgroundActor(val background: Drawable, align: Int) : Actor() { batch.setColor(color.r, color.g, color.b, color.a * parentAlpha) background.draw(batch, x, y, w, h) } - - companion object { - fun getRoundedEdgeRectangle(tintColor: Color): NinePatchDrawable { - val region = ImageGetter.getDrawable("Skin/roundedEdgeRectangle").region - val drawable = NinePatchDrawable(NinePatch(region, 25, 25, 24, 24)) - drawable.setPadding(15f, 15f, 15f, 15f) - return drawable.tint(tintColor) - } - } } diff --git a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt index d8d777eb0a..9c652abf6b 100644 --- a/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt +++ b/core/src/com/unciv/ui/worldscreen/WorldScreenTopBar.kt @@ -81,10 +81,10 @@ class WorldScreenTopBar(val worldScreen: WorldScreen) : Table() { resourceTable.background = backgroundDrawable add(statsTable).colspan(3).growX().row() add(resourceTable).colspan(3).growX().row() - val leftFillerBG = BackgroundActor.getRoundedEdgeRectangle(backColor) + val leftFillerBG = ImageGetter.getRoundedEdgeRectangle(backColor) leftFillerCell = add(BackgroundActor(leftFillerBG, Align.topLeft)) add().growX() - val rightFillerBG = BackgroundActor.getRoundedEdgeRectangle(backColor) + val rightFillerBG = ImageGetter.getRoundedEdgeRectangle(backColor) rightFillerCell = add(BackgroundActor(rightFillerBG, Align.topRight)) pack() }