mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-16 21:44:05 +09:00
adding extra headroom to the assembled sprite so that a large held item wouldn't get cropped
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user