some UIs can be closed with ESC key

This commit is contained in:
minjaesong
2019-07-08 21:50:35 +09:00
parent f95ea1ab0f
commit e4974025a0
3 changed files with 24 additions and 15 deletions

View File

@@ -1,7 +1,5 @@
package net.torvald.terrarum.modulebasegame.gameactors
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.Input
import com.badlogic.gdx.graphics.Camera
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.g2d.SpriteBatch
@@ -38,7 +36,11 @@ internal class FixtureCraftingTable : FixtureBase(
internal object UICraftingTable : UICanvas() {
override var width = 512
override var height = 512
override var openCloseTime: Second = 0.05f
override var openCloseTime: Second = 0.0f
init {
handler.allowESCtoClose = true
}
override fun updateUI(delta: Float) {
@@ -49,10 +51,6 @@ internal object UICraftingTable : UICanvas() {
batch.color = Color.WHITE
batch.draw(AppLoader.resourcePool.getAsTextureRegion("test_texture"), 0f, 0f)
if (Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) {
handler.setAsClose()
}
}
override fun doOpening(delta: Float) {

View File

@@ -43,7 +43,9 @@ class UIInventoryFull(
val internalWidth: Int = UIItemInventoryDynamicList.WIDTH + UIItemInventoryEquippedView.WIDTH + itemListToEquipViewGap
val internalHeight: Int = 166 + UIItemInventoryDynamicList.HEIGHT // grad_begin..grad_end..contents..grad_begin..grad_end
init {
handler.allowESCtoClose = true
}
internal val catIcons: TextureRegionPack = TextureRegionPack("./assets/graphics/gui/inventory/category.tga", 20, 20)
internal val catArrangement: IntArray = intArrayOf(9,6,7,1,0,2,3,4,5,8)