Borders made of oriented triangles rather than circles (#2104)
This commit is contained in:
parent
61565c0ee6
commit
0cf27789e9
6 changed files with 676 additions and 662 deletions
BIN
android/Images/OtherIcons/Triangle.png
Normal file
BIN
android/Images/OtherIcons/Triangle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
File diff suppressed because it is too large
Load diff
Binary file not shown.
Before Width: | Height: | Size: 906 KiB After Width: | Height: | Size: 907 KiB |
Binary file not shown.
Before Width: | Height: | Size: 379 KiB After Width: | Height: | Size: 369 KiB |
|
@ -15,7 +15,8 @@ import com.unciv.models.ruleset.unit.UnitType
|
||||||
import com.unciv.ui.utils.ImageGetter
|
import com.unciv.ui.utils.ImageGetter
|
||||||
import com.unciv.ui.utils.center
|
import com.unciv.ui.utils.center
|
||||||
import com.unciv.ui.utils.centerX
|
import com.unciv.ui.utils.centerX
|
||||||
|
import kotlin.math.PI
|
||||||
|
import kotlin.math.atan
|
||||||
|
|
||||||
|
|
||||||
open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) : Group() {
|
open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings) : Group() {
|
||||||
|
@ -385,8 +386,13 @@ open class TileGroup(var tileInfo: TileInfo, var tileSetStrings:TileSetStrings)
|
||||||
val images = mutableListOf<Image>()
|
val images = mutableListOf<Image>()
|
||||||
borderImages[neighbor] = images
|
borderImages[neighbor] = images
|
||||||
for (i in -2..2) {
|
for (i in -2..2) {
|
||||||
val image = ImageGetter.getCircle()
|
val image = ImageGetter.getTriangle()
|
||||||
|
val sign = if (relativeWorldPosition.x < 0) -1 else 1
|
||||||
|
val angle = sign * (atan(sign * relativeWorldPosition.y / relativeWorldPosition.x) * 180 / PI - 90.0)
|
||||||
|
|
||||||
image.setSize(5f, 5f)
|
image.setSize(5f, 5f)
|
||||||
|
image.setOrigin(image.width/2,image.height/2)
|
||||||
|
image.rotateBy(angle.toFloat())
|
||||||
image.center(this)
|
image.center(this)
|
||||||
// in addTiles, we set the position of groups by relative world position *0.8*groupSize, filter groupSize = 50
|
// in addTiles, we set the position of groups by relative world position *0.8*groupSize, filter groupSize = 50
|
||||||
// Here, we want to have the borders start HALFWAY THERE and extend towards the tiles, so we give them a position of 0.8*25.
|
// Here, we want to have the borders start HALFWAY THERE and extend towards the tiles, so we give them a position of 0.8*25.
|
||||||
|
|
|
@ -184,6 +184,7 @@ object ImageGetter {
|
||||||
fun getBlue() = Color(0x004085bf)
|
fun getBlue() = Color(0x004085bf)
|
||||||
|
|
||||||
fun getCircle() = getImage("OtherIcons/Circle")
|
fun getCircle() = getImage("OtherIcons/Circle")
|
||||||
|
fun getTriangle() = getImage("OtherIcons/Triangle")
|
||||||
|
|
||||||
fun getBackground(color:Color): Drawable {
|
fun getBackground(color:Color): Drawable {
|
||||||
val drawable = getDrawable("OtherIcons/TableBackground")
|
val drawable = getDrawable("OtherIcons/TableBackground")
|
||||||
|
|
Loading…
Reference in a new issue