mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-13 15:16:07 +09:00
minor changes to the graphics control panel
This commit is contained in:
BIN
assets/graphics/gui/hrule.tga
LFS
Normal file
BIN
assets/graphics/gui/hrule.tga
LFS
Normal file
Binary file not shown.
@@ -65,7 +65,6 @@ class TitleScreen(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
private lateinit var demoWorld: GameWorld
|
||||
private lateinit var cameraNodes: FloatArray // camera Y-pos
|
||||
private val cameraAI = object : ActorAI {
|
||||
|
||||
private var firstTime = true
|
||||
private val lookaheadDist = 100.0
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@ import net.torvald.terrarum.itemproperties.Material
|
||||
*/
|
||||
open class HumanoidNPC : ActorHumanoid, AIControlled, CanBeAnItem {
|
||||
|
||||
override lateinit var ai: ActorAI
|
||||
var aiName: String = ""
|
||||
@Transient override lateinit var ai: ActorAI
|
||||
|
||||
companion object {
|
||||
val DEFAULT_COLLISION_TYPE = COLLISION_DYNAMIC
|
||||
@@ -26,6 +27,7 @@ open class HumanoidNPC : ActorHumanoid, AIControlled, CanBeAnItem {
|
||||
|
||||
constructor(ai: ActorAI, born: Long) : super(born) {
|
||||
this.ai = ai
|
||||
this.aiName = ai::class.java.canonicalName
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.torvald.terrarum.gameactors.*
|
||||
*/
|
||||
class PhysTestLuarLander : ActorWithBody(RenderOrder.MIDTOP, PhysProperties.PHYSICS_OBJECT), Controllable {
|
||||
|
||||
private val texture = Texture(ModMgr.getGdxFile("basegame", "sprites/phystest_lunarlander.tga"))
|
||||
@Transient private val texture = Texture(ModMgr.getGdxFile("basegame", "sprites/phystest_lunarlander.tga"))
|
||||
|
||||
override val hitbox: Hitbox
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package net.torvald.terrarum.modulebasegame.ui
|
||||
|
||||
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
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ceilInt
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull.Companion.CELL_COL
|
||||
import net.torvald.terrarum.ui.*
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import net.torvald.unicode.TIMES
|
||||
|
||||
/**
|
||||
@@ -43,6 +46,13 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
private val optionsYpos = IntArray(options.size + 1)
|
||||
|
||||
init {
|
||||
CommonResourcePool.addToLoadingList("gui_hrule") {
|
||||
TextureRegionPack(Gdx.files.internal("assets/graphics/gui/hrule.tga"), 216, 20)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
|
||||
|
||||
var akku = 0
|
||||
options.forEachIndexed { index, row ->
|
||||
val option = row[2]
|
||||
@@ -60,10 +70,10 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
}
|
||||
optionsYpos[optionsYpos.lastIndex] = akku
|
||||
}
|
||||
|
||||
override var width = 420
|
||||
override var width = 560
|
||||
override var height = optionsYpos.last()
|
||||
|
||||
private val hrule = CommonResourcePool.getAsTextureRegionPack("gui_hrule")
|
||||
|
||||
private val spinnerWidth = 140
|
||||
private val drawX = (Toolkit.drawWidth - width) / 2
|
||||
@@ -171,6 +181,13 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
drawX + width/2 - panelgap - labelWidth // right aligned at the middle of the panel, offsetted by panelgap
|
||||
|
||||
App.fontGame.draw(batch, label, xpos.toFloat(), drawY + optionsYpos[index].toFloat())
|
||||
|
||||
// draw hrule
|
||||
if (mode == "h1") {
|
||||
val ruleWidth = ((width - 24 - labelWidth) / 2).toFloat()
|
||||
batch.draw(hrule.get(0,0), xpos - 24f - ruleWidth, drawY + optionsYpos[index].toFloat(), ruleWidth, hrule.tileH.toFloat())
|
||||
batch.draw(hrule.get(0,1), xpos + 24f + labelWidth, drawY + optionsYpos[index].toFloat(), ruleWidth, hrule.tileH.toFloat())
|
||||
}
|
||||
}
|
||||
uiItems.forEach { it.render(batch, camera) }
|
||||
|
||||
|
||||
BIN
work_files/graphics/gui/hrule.kra
LFS
Normal file
BIN
work_files/graphics/gui/hrule.kra
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user