Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Deficuet authored and Deficuet committed Jan 7, 2024
1 parent 743b4b9 commit 0fdcfac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ So far the objects that can export data includes:
- `getImage` - A BufferedImage created from the decompressed data. **It is usually up-side-down**.
- If the format of the texture is unsupported, both functions will return `null`.
- Sprite
- `getImage` - An **upright** BufferedImage cropped from a `Texture2D` image. The function will return `null` if the `Texture2D` object is not found or the format is unsupported.
- `getImage` - An BufferedImage cropped from a `Texture2D` image. Will return `null` if the `Texture2D` object is not found or the format is unsupported.
- The packing mode `SpritePackingMode.Tight` is not supported yet.
- TextAsset
- `text(charset)` - This function is used to export content in this object as `String`. A `Charset` can be passed as a parameter, by default it is `Charsets.UTF_8`.
- Shader
Expand Down
8 changes: 2 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
buildscript {
ext.kotlin_version = "1.8.21"
}

plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.8.21'
id 'maven-publish'
}

group 'io.github.deficuet'
version '0.0.1'
version '0.1.0_alpha.5'

repositories {
mavenCentral()
Expand All @@ -21,7 +17,7 @@ dependencies {
implementation 'org.json:json:20230618'
implementation 'org.lz4:lz4-java:1.8.0'
implementation 'com.nixxcode.jvmbrotli:jvmbrotli:0.2.0'
implementation 'com.github.Deficuet:JImageUtils:0.0.3.a'
implementation 'com.github.Deficuet:JImageUtils:0.0.4'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/io/github/deficuet/unitykt/classes/Sprite.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ interface Sprite: NamedObject {
val mRD: SpriteRenderData
val mPhysicsShape: Array<out Array<out Vector2>>

/**
* Has the same orientation as the parent [Texture2D]
*
* i.e. usually up-side-down
*/
fun getImage(): BufferedImage?
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,24 +155,24 @@ internal class SpriteImpl(
if (settingsRow.packed == 1u) {
when (settingsRow.packingRotation) {
SpritePackingRotation.FlipHorizontal -> {
spriteImage = spriteImage.use { flipX() }
spriteImage = spriteImage.flipX().apply(true)
}
SpritePackingRotation.FlipVertical -> {
spriteImage = spriteImage.use { flipY() }
spriteImage = spriteImage.flipY().apply(true)
}
SpritePackingRotation.Rotate90 -> {
spriteImage = spriteImage.use { quadrantRotate(3) }
spriteImage = spriteImage.quadrantRotate(3).apply(true)
}
SpritePackingRotation.Rotate180 -> {
spriteImage = spriteImage.use { quadrantRotate(2) }
spriteImage = spriteImage.quadrantRotate(2).apply(true)
}
else -> { }
}
}
// if (settingsRow.packingMode == SpritePackingMode.Tight) {
// TODO("Sprite image tight")
// }
return spriteImage.use { flipY() }
return spriteImage
}
return null
}
Expand Down

0 comments on commit 0fdcfac

Please sign in to comment.