adding extra headroom to the assembled sprite so that a large held item wouldn't get cropped

This commit is contained in:
minjaesong
2022-02-07 11:38:26 +09:00
parent e64bd5d389
commit 4612493566
4 changed files with 13 additions and 6 deletions

View File

@@ -76,6 +76,8 @@ class ADProperties {
companion object {
const val ALL_JOINT_SELECT_KEY = "ALL"
const val EXTRA_HEADROOM_X = 32
const val EXTRA_HEADROOM_Y = 16
}
constructor(gdxFile: FileHandle) {
@@ -118,8 +120,8 @@ class ADProperties {
baseFilename = get("SPRITESHEET")[0].name
extension = get("EXTENSION")[0].name
val frameSizeVec = get("CONFIG").linearSearchBy { it.name == "SIZE" }!!.input as ADPropertyObject.Vector2i
frameWidth = frameSizeVec.x
frameHeight = frameSizeVec.y
frameWidth = frameSizeVec.x + EXTRA_HEADROOM_X
frameHeight = frameSizeVec.y + EXTRA_HEADROOM_Y
originX = (get("CONFIG").linearSearchBy { it.name == "ORIGINX" }!!.input as Float).toInt()
var maxColFinder = -1

View File

@@ -52,11 +52,11 @@ object AssembleSheetPixmap {
private fun drawAndGetCanvas(properties: ADProperties, fileGetter: (String) -> InputStream?, injectedItem: GameItem?): Pixmap {
val canvas = Pixmap(properties.cols * properties.frameWidth, properties.rows * properties.frameHeight, Pixmap.Format.RGBA8888)
val canvas = Pixmap(properties.cols * (properties.frameWidth), properties.rows * (properties.frameHeight), Pixmap.Format.RGBA8888)
canvas.blending = Pixmap.Blending.SourceOver
// actually draw
properties.transforms.forEach { t, _ ->
properties.transforms.forEach { (t, _) ->
drawThisFrame(t, canvas, properties, fileGetter, injectedItem)
}