adjusting disposing behavs so that we can go back and forth the ingame and titlescr

This commit is contained in:
minjaesong
2019-01-31 00:12:38 +09:00
parent 1475fa08dc
commit b3e323965f
12 changed files with 62 additions and 49 deletions

View File

@@ -3,6 +3,7 @@ package net.torvald.terrarum.ui
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.utils.Disposable
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.Second
import net.torvald.terrarum.Terrarum
@@ -21,7 +22,7 @@ abstract class UICanvas(
// UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
customPositioning: Boolean = false, // mainly used by vital meter
doNotWarnConstant: Boolean = false
) {
): Disposable {
abstract var width: Int
abstract var height: Int
@@ -36,7 +37,7 @@ abstract class UICanvas(
/**
* Usage: (in StateInGame:) uiHandlerField.ui.handler = uiHandlerField
*/
protected val handler = UIHandler(toggleKeyLiteral, toggleButtonLiteral, customPositioning, doNotWarnConstant)
val handler = UIHandler(toggleKeyLiteral, toggleButtonLiteral, customPositioning, doNotWarnConstant)
init {
@@ -111,7 +112,7 @@ abstract class UICanvas(
*/
abstract fun endClosing(delta: Float)
abstract fun dispose()
abstract override fun dispose()
fun addItem(uiItem: UIItem) {
uiItems.add(uiItem)