Skip to content
This repository has been archived by the owner on Dec 28, 2021. It is now read-only.

Commit

Permalink
Merge pull request #3 from LeHaine/release-0.8.1
Browse files Browse the repository at this point in the history
Release 0.8.1
  • Loading branch information
LeHaine authored Mar 12, 2021
2 parents db4daa3 + ee3ee6e commit 3d9f96e
Show file tree
Hide file tree
Showing 26 changed files with 7,514 additions and 10,153 deletions.
16 changes: 0 additions & 16 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
allprojects {
group = "com.lehaine"
version = "0.6.1"
version = "0.8.1-b1"
}


Expand Down
24 changes: 18 additions & 6 deletions ldtk-api/src/main/kotlin/com/lehaine/ldtk/Entity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,28 @@ open class Entity(val json: EntityInstanceJson) {
/** Pixel-based Y coordinate **/
val pixelY: Int = json.px[1]

/** Pivot X coord (0-1) **/
val pivotX: Float = if (json.__pivot.isNullOrEmpty()) 0f else json.__pivot[0]

/** Pivot Y coord (0-1) **/
val pivotY: Float = if (json.__pivot.isNullOrEmpty()) 0f else json.__pivot[1]

/** Width in pixels **/
val width: Int = json.width

/** Height in pixels**/
val height: Int = json.height

/** Tile infos if the entity has one (it could have been overridden by a Field value, such as Enums) **/
val tileInfosJson: TileInfo? = if (json.__tileJson == null) {
val tileInfosJson: TileInfo? = if (json.__tile == null) {
null
} else {
TileInfo(
tilesetUid = json.__tileJson.tilesetUid,
x = json.__tileJson.srcRect[0],
y = json.__tileJson.srcRect[1],
w = json.__tileJson.srcRect[2],
h = json.__tileJson.srcRect[3]
tilesetUid = json.__tile.tilesetUid,
x = json.__tile.srcRect[0],
y = json.__tile.srcRect[1],
w = json.__tile.srcRect[2],
h = json.__tile.srcRect[3]
)
}

Expand Down
Loading

0 comments on commit 3d9f96e

Please sign in to comment.