Skip to content

Commit 6cba0b4

Browse files
committed
feat: FrameData now supports offsets, closes #1181
1 parent 9d5fe3a commit 6cba0b4

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

fxgl-core/src/main/kotlin/com/almasb/fxgl/texture/AnimatedTexture.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ class AnimatedTexture(defaultChannel: AnimationChannel) : Texture(defaultChannel
152152
fitWidth = frameData.width.toDouble()
153153
fitHeight = frameData.height.toDouble()
154154
viewport = frameData.viewport
155+
156+
layoutX = frameData.offsetX.toDouble()
157+
layoutY = frameData.offsetY.toDouble()
155158
}
156159

157160
private fun updateAnimation() {

fxgl-core/src/main/kotlin/com/almasb/fxgl/texture/AnimationChannel.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,7 @@ data class FrameData(
122122
val height: Int
123123
) {
124124
val viewport = Rectangle2D(x.toDouble(), y.toDouble(), width.toDouble(), height.toDouble())
125+
126+
var offsetX = 0
127+
var offsetY = 0
125128
}

0 commit comments

Comments
 (0)