Skip to content

Commit

Permalink
Merge pull request #2 from korlibs/bump/korge-5.0.2
Browse files Browse the repository at this point in the history
Bump KorGE to 5.0.2
  • Loading branch information
soywiz authored Oct 2, 2023
2 parents a4e753a + 9ecac99 commit 907faf6
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
14 changes: 1 addition & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import korlibs.korge.gradle.*

plugins {
//alias(libs.plugins.korge)
id("com.soywiz.korge") version "4.0.3"
alias(libs.plugins.korge)
}

korge {
id = "org.korge.samples.demoldtk"

// To enable all targets at once

//targetAll()

// To enable targets based on properties/environment variables
//targetDefault()

// To selectively enable targets

targetJvm()
targetJs()
targetDesktop()
//targetDesktopCross()
targetIos()
targetAndroid()

Expand Down
3 changes: 3 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[plugins]
korge = { id = "com.soywiz.korge", version = "5.0.2" }
#korge = { id = "com.soywiz.korge", version = "999.0.0.999" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ private fun IStackedIntArray2.getFirst(pos: PointInt): Int = getFirst(pos.x, pos
private fun IStackedIntArray2.getLast(pos: PointInt): Int = getLast(pos.x, pos.y)

class LDTKCollisions(val world: LDTKWorld, val stack: IStackedIntArray2) {
fun tileToPixel(tilePos: PointInt): PointInt = (tilePos.toFloat() * world.ldtk.defaultGridSize).toIntFloor()
fun pixelToTile(pixelPos: PointInt): PointInt = (pixelPos.toFloat() / world.ldtk.defaultGridSize).toIntFloor()
fun tileToPixel(tilePos: PointInt): PointInt = (tilePos.toDouble() * world.ldtk.defaultGridSize).toIntFloor()
fun pixelToTile(pixelPos: PointInt): PointInt = (pixelPos.toDouble() / world.ldtk.defaultGridSize).toIntFloor()

fun getTile(tilePos: PointInt): Int = stack.getLast(tilePos)
fun getPixel(pixelPos: PointInt): Int = getTile(pixelToTile(pixelPos))
Expand Down Expand Up @@ -64,7 +64,7 @@ class LDTKEntityView(
}

val anchor = entity.pivotAnchor
val gridSize = llayer.layer.gridSize.toFloat()
val gridSize = llayer.layer.gridSize.toDouble()
val tile: TilesetRectangle? = entity.tile
val tileset = llayer.world.tilesetDefsById[tile?.tilesetUid]
val utileset = tileset?.unextrudedTileSet
Expand All @@ -79,7 +79,7 @@ class LDTKEntityView(
//view.anchor(anchor)
}
init {
val pos = entity.gridPos.toFloat() * gridSize + anchor.toVector() * gridSize
val pos = entity.gridPos.toDouble() * gridSize + anchor.toVector() * gridSize
view
.size(entity.width, entity.height)
(view as? Anchorable)?.anchor(anchor)
Expand Down
22 changes: 15 additions & 7 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
pluginManagement { repositories { mavenLocal(); mavenCentral(); google(); gradlePluginPortal() } }

plugins {
//id("com.soywiz.kproject.settings") version "0.0.1-SNAPSHOT"
id("com.soywiz.kproject.settings") version "0.3.1"
pluginManagement {
repositories { mavenLocal(); mavenCentral(); google(); gradlePluginPortal() }
}

rootProject.name = "${rootDir.name}-example"
// @TODO: Why can't we just use libs here? We can't even use a TOML parser since it is gradle internal, and we cannot load a library in a reasonably way here.
plugins {
val libsTomlFile = File("gradle/libs.versions.toml").readText()
var plugins = false
var version = ""
for (line in libsTomlFile.lines().map { it.trim() }) {
if (line.startsWith("#")) continue
if (line.startsWith("[plugins]")) plugins = true
if (plugins && line.startsWith("korge") && Regex("^korge\\s*=.*").containsMatchIn(line)) version = Regex("version\\s*=\\s*\"(.*?)\"").find(line)?.groupValues?.get(1) ?: error("Can't find korge version")
}
if (version.isEmpty()) error("Can't find korge version in $libsTomlFile")

kproject("./deps")
id("com.soywiz.korge.settings") version version
}

0 comments on commit 907faf6

Please sign in to comment.