Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump KorGE to 5.0.2 #2

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
Loading