mirror of
https://github.com/nacabaro/vbhelper.git
synced 2026-06-05 22:02:54 +00:00
Fixed sprite sizing.
This commit is contained in:
parent
a4b159da45
commit
266658342a
@ -98,10 +98,24 @@ class BattleSpriteManager(private val context: Context) {
|
|||||||
spriteData.texture_rect.height.toInt()
|
spriteData.texture_rect.height.toInt()
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cache the result
|
// Ensure the bitmap is not scaled and has proper quality
|
||||||
spriteCache[cacheKey] = spriteBitmap
|
val finalBitmap = if (spriteBitmap.width != spriteData.texture_rect.width.toInt() ||
|
||||||
|
spriteBitmap.height != spriteData.texture_rect.height.toInt()) {
|
||||||
|
// If the bitmap was scaled during creation, create a new one with exact dimensions
|
||||||
|
Bitmap.createScaledBitmap(spriteBitmap,
|
||||||
|
spriteData.texture_rect.width.toInt(),
|
||||||
|
spriteData.texture_rect.height.toInt(),
|
||||||
|
false) // false = no filtering/interpolation
|
||||||
|
} else {
|
||||||
|
spriteBitmap
|
||||||
|
}
|
||||||
|
|
||||||
return spriteBitmap
|
println("Extracted sprite dimensions: ${finalBitmap.width}x${finalBitmap.height}")
|
||||||
|
|
||||||
|
// Cache the result
|
||||||
|
spriteCache[cacheKey] = finalBitmap
|
||||||
|
|
||||||
|
return finalBitmap
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
|||||||
@ -347,21 +347,20 @@ fun PlayerBattleView(
|
|||||||
|
|
||||||
// Player character with attack animation
|
// Player character with attack animation
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.size(120.dp),
|
modifier = Modifier.size(80.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
SpriteImage(
|
SpriteImage(
|
||||||
spriteName = "00", // The sprite number (00, 01, 02, etc.)
|
spriteName = "00", // The sprite number (00, 01, 02, etc.)
|
||||||
atlasName = activeCharacter?.charaId ?: when (stage) {
|
atlasName = activeCharacter?.charaId ?: when (stage) {
|
||||||
"rookie" -> "dim275_mon01"
|
"rookie" -> "dim000_mon03"
|
||||||
"champion" -> "dim012_mon04"
|
"champion" -> "dim012_mon04"
|
||||||
"ultimate" -> "dim137_mon09"
|
"ultimate" -> "dim137_mon09"
|
||||||
"mega" -> "dim012_mon14"
|
"mega" -> "dim012_mon14"
|
||||||
else -> "dim275_mon01"
|
else -> "dim011_mon01"
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(120.dp)
|
.size(80.dp),
|
||||||
.scale(2f),
|
|
||||||
contentScale = ContentScale.Fit
|
contentScale = ContentScale.Fit
|
||||||
)
|
)
|
||||||
/*
|
/*
|
||||||
@ -386,7 +385,7 @@ fun PlayerBattleView(
|
|||||||
// Attack animation overlay
|
// Attack animation overlay
|
||||||
if (attackAnimationProgress > 0) {
|
if (attackAnimationProgress > 0) {
|
||||||
AttackSpriteImage(
|
AttackSpriteImage(
|
||||||
characterId = activeCharacter?.charaId ?: "dim275_mon01",
|
characterId = activeCharacter?.charaId ?: "dim011_mon01",
|
||||||
isLarge = true,
|
isLarge = true,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
@ -496,21 +495,20 @@ fun OpponentBattleView(
|
|||||||
|
|
||||||
// Opponent character with attack animation
|
// Opponent character with attack animation
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.size(120.dp),
|
modifier = Modifier.size(80.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
SpriteImage(
|
SpriteImage(
|
||||||
spriteName = "00", // The sprite number (00, 01, 02, etc.)
|
spriteName = "00", // The sprite number (00, 01, 02, etc.)
|
||||||
atlasName = activeCharacter?.charaId ?: when (stage) {
|
atlasName = activeCharacter?.charaId ?: when (stage) {
|
||||||
"rookie" -> "dim275_mon01"
|
"rookie" -> "dim000_mon03"
|
||||||
"champion" -> "dim012_mon04"
|
"champion" -> "dim012_mon04"
|
||||||
"ultimate" -> "dim137_mon09"
|
"ultimate" -> "dim137_mon09"
|
||||||
"mega" -> "dim012_mon14"
|
"mega" -> "dim012_mon14"
|
||||||
else -> "dim275_mon01"
|
else -> "dim011_mon01"
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(120.dp)
|
.size(80.dp),
|
||||||
.scale(2f),
|
|
||||||
contentScale = ContentScale.Fit
|
contentScale = ContentScale.Fit
|
||||||
)
|
)
|
||||||
/*
|
/*
|
||||||
@ -535,7 +533,7 @@ fun OpponentBattleView(
|
|||||||
// Attack animation overlay
|
// Attack animation overlay
|
||||||
if (attackAnimationProgress > 0) {
|
if (attackAnimationProgress > 0) {
|
||||||
AttackSpriteImage(
|
AttackSpriteImage(
|
||||||
characterId = activeCharacter?.charaId ?: "dim275_mon01",
|
characterId = activeCharacter?.charaId ?: "dim011_mon01",
|
||||||
isLarge = true,
|
isLarge = true,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(60.dp)
|
.size(60.dp)
|
||||||
@ -759,7 +757,7 @@ fun BattlesScreen() {
|
|||||||
// Create hardcoded character lists for each stage
|
// Create hardcoded character lists for each stage
|
||||||
val rookieCharacters = listOf(
|
val rookieCharacters = listOf(
|
||||||
APIBattleCharacter("AGUMON", "degimon_name_Dim012_003", "dim012_mon03", 0, 1, 1800, 1800, 2400.0f, 700.0f),
|
APIBattleCharacter("AGUMON", "degimon_name_Dim012_003", "dim012_mon03", 0, 1, 1800, 1800, 2400.0f, 700.0f),
|
||||||
APIBattleCharacter("PULSEMON", "degimon_name_Dim275_001", "dim275_mon01", 0, 1, 1800, 1800, 2400.0f, 700.0f),
|
APIBattleCharacter("PULSEMON", "degimon_name_Dim000_003", "dim000_mon03", 0, 1, 1800, 1800, 2400.0f, 700.0f),
|
||||||
APIBattleCharacter("DORUMON", "degimon_name_dim137_mon03", "dim137_mon03", 0, 1, 3000, 3000, 5100.0f, 1050.0f)
|
APIBattleCharacter("DORUMON", "degimon_name_dim137_mon03", "dim137_mon03", 0, 1, 3000, 3000, 5100.0f, 1050.0f)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user