Skip to content

Commit

Permalink
Fix getPaddedWidth() and getPaddedHeight() missing cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Reco1I committed Dec 27, 2024
1 parent df8316d commit 92c006f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/com/reco1l/andengine/Entities.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.reco1l.andengine

import com.reco1l.framework.math.Vec4
import org.anddev.andengine.entity.IEntity
import org.anddev.andengine.entity.scene.CameraScene
import org.anddev.andengine.entity.shape.IShape


Expand All @@ -12,12 +13,14 @@ fun IEntity?.getPadding() = when (this) {

fun IEntity?.getPaddedWidth() = when (this) {
is ExtendedEntity -> drawWidth - padding.horizontal
is CameraScene -> camera.widthRaw
is IShape -> width
else -> 0f
}

fun IEntity?.getPaddedHeight() = when (this) {
is ExtendedEntity -> drawHeight - padding.vertical
is CameraScene -> camera.heightRaw
is IShape -> height
else -> 0f
}
Expand Down

0 comments on commit 92c006f

Please sign in to comment.