fixed a NaN bug caused by a zero-width/height hitbox

Also inventory is widened to 10x7 of prev 9x7
This commit is contained in:
minjaesong
2018-11-06 04:02:33 +09:00
parent 5c8cdd3162
commit c7c68187eb
14 changed files with 78 additions and 43 deletions

View File

@@ -110,10 +110,8 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
}
override fun render(delta: Float) {
Gdx.graphics.setTitle("${AppLoader.GAME_NAME} Building Maker" +
" — F: ${Gdx.graphics.framesPerSecond} (${Terrarum.TARGET_INTERNAL_FPS})" +
" — M: ${Terrarum.memInUse}M / ${Terrarum.memTotal}M / ${Terrarum.memXmx}M"
)
Gdx.graphics.setTitle(Ingame.getCanonicalTitle())
// ASYNCHRONOUS UPDATE AND RENDER //

View File

@@ -79,6 +79,10 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
camera.update()
batch.projectionMatrix = camera.combined
}
fun getCanonicalTitle() = AppLoader.GAME_NAME +
" — F: ${Gdx.graphics.framesPerSecond} (${Terrarum.TARGET_INTERNAL_FPS})" +
" — M: J${Terrarum.memJavaHeap}M / N${Terrarum.memNativeHeap}M / X${Terrarum.memXmx}M"
}
@@ -461,10 +465,7 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
Gdx.graphics.setTitle(AppLoader.GAME_NAME +
" — F: ${Gdx.graphics.framesPerSecond} (${Terrarum.TARGET_INTERNAL_FPS})" +
" — M: ${Terrarum.memInUse}M / ${Terrarum.memTotal}M / ${Terrarum.memXmx}M"
)
Gdx.graphics.setTitle(getCanonicalTitle())
// ASYNCHRONOUS UPDATE AND RENDER //
@@ -913,7 +914,8 @@ open class Ingame(batch: SpriteBatch) : IngameInstance(batch) {
*/
override fun resize(width: Int, height: Int) {
MegaRainGovernor.resize()
// FIXME debugger is pointing at this thing, not sure it actually caused memleak
//MegaRainGovernor.resize()
IngameRenderer.resize(Terrarum.WIDTH, Terrarum.HEIGHT)

View File

@@ -31,7 +31,7 @@ class UIInventoryFull(
override var width: Int = Terrarum.WIDTH
override var height: Int = Terrarum.HEIGHT
val internalWidth: Int = 630
val internalWidth: Int = 686
val internalHeight: Int = 558 // grad_begin..grad_end..contents..grad_begin..grad_end

View File

@@ -23,8 +23,8 @@ import java.util.ArrayList
*
* Note: everything is pretty much fixed size.
*
* Dimension of the whole area: 496x384
* Number of grids: 9x7
* Dimension of the whole area: 552x384
* Number of grids: 10x7
* Number of lists: 2x7
*
* Created by minjaesong on 2017-10-21.
@@ -79,9 +79,9 @@ class UIItemInventoryDynamicList(
7 * 2, {
UIItemInventoryElem(
parentUI = inventoryUI,
posX = this.posX + (244 + listGap) * (it % 2),
posX = this.posX + (272 + listGap) * (it % 2),
posY = this.posY + (UIItemInventoryElem.height + listGap) * (it / 2),
width = 244,
width = 272,
item = null,
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
itemImage = null,
@@ -93,11 +93,11 @@ class UIItemInventoryDynamicList(
inactiveTextCol = defaultTextColour
) })
private val itemGrid = Array<UIItemInventoryCellBase>(
7 * 9, {
7 * 10, {
UIItemInventoryElemSimple(
parentUI = inventoryUI,
posX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % 9),
posY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / 9),
posX = this.posX + (UIItemInventoryElemSimple.height + listGap) * (it % 10),
posY = this.posY + (UIItemInventoryElemSimple.height + listGap) * (it / 10),
item = null,
amount = UIItemInventoryElem.UNIQUE_ITEM_HAS_NO_AMOUNT,
itemImage = null,

View File

@@ -320,7 +320,7 @@ open class UIRemoCon(treeRepresentation: QNDTreeNode<String>) : UICanvas() {
}
companion object {
val remoConWidth = 280
val remoConWidth = 304
fun getRemoConHeight(menu: ArrayList<String>) = 36 * menu.size.plus(1)
fun getRemoConHeight(menu: Array<String>) = 36 * menu.size.plus(1)
val menubarOffY: Int; get() = Terrarum.HEIGHT / 2 - (Terrarum.fontGame.lineHeight * 1.5).toInt()