mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 16:46:07 +09:00
buildingmaker resurrection wip
This commit is contained in:
@@ -127,9 +127,9 @@ object SanicLoadScreen : LoadScreenBase() {
|
|||||||
// draw colour overlay, flipped
|
// draw colour overlay, flipped
|
||||||
it.draw(textOverlayTex,
|
it.draw(textOverlayTex,
|
||||||
(textFbo.width - textWidth) / 2f,
|
(textFbo.width - textWidth) / 2f,
|
||||||
App.fontGame.lineHeight,
|
0f,
|
||||||
textWidth,
|
textWidth,
|
||||||
-App.fontGame.lineHeight
|
App.fontGame.lineHeight
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +155,7 @@ object SanicLoadScreen : LoadScreenBase() {
|
|||||||
// --> original text
|
// --> original text
|
||||||
if (genuineSonic) {
|
if (genuineSonic) {
|
||||||
it.color = Color.WHITE
|
it.color = Color.WHITE
|
||||||
it.draw(textTex, textX, glideDispY - 2f)
|
it.draw(textTex, textX, glideDispY - 2f + textTex.height, textTex.width.toFloat(), -textTex.height.toFloat())
|
||||||
}
|
}
|
||||||
|
|
||||||
// --> ghost
|
// --> ghost
|
||||||
|
|||||||
@@ -43,19 +43,28 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
|||||||
// TODO scrolling of the palette, as the old method flat out won't work with The Flattening
|
// TODO scrolling of the palette, as the old method flat out won't work with The Flattening
|
||||||
|
|
||||||
private val tabs = UIItemTextButtonList(
|
private val tabs = UIItemTextButtonList(
|
||||||
this, 36, arrayOf("Terrain", "Wall", "Wire"),
|
this, 36, arrayOf("Terrain", "Wall", "Wire"),
|
||||||
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
|
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
|
||||||
defaultSelection = 0
|
defaultSelection = 0,
|
||||||
|
backgroundCol = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL
|
||||||
)
|
)
|
||||||
private val closeButton = UIItemTextButtonList(
|
private val closeButton = UIItemTextButtonList(
|
||||||
this, 36, arrayOf("Close"),
|
this, 36, arrayOf("Close"),
|
||||||
0, this.height - UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
|
0, this.height - UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
|
||||||
width = MENUBAR_SIZE, textAreaWidth = MENUBAR_SIZE
|
width = MENUBAR_SIZE, textAreaWidth = MENUBAR_SIZE,
|
||||||
|
backgroundCol = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL
|
||||||
)
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|
||||||
BlockCodex.getAll().forEachIndexed { index, prop ->
|
BlockCodex.getAll().filter {
|
||||||
|
(try {
|
||||||
|
ItemCodex.getItemImage(it.id)
|
||||||
|
}
|
||||||
|
catch (e: NullPointerException) {
|
||||||
|
null
|
||||||
|
}) != null
|
||||||
|
}.forEachIndexed { index, prop ->
|
||||||
val paletteItem = UIItemImageButton(
|
val paletteItem = UIItemImageButton(
|
||||||
this, ItemCodex.getItemImage(prop.id)!!,
|
this, ItemCodex.getItemImage(prop.id)!!,
|
||||||
initialX = MENUBAR_SIZE + (index % 16) * TILESREGION_SIZE,
|
initialX = MENUBAR_SIZE + (index % 16) * TILESREGION_SIZE,
|
||||||
@@ -128,9 +137,15 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
palette.forEach { it.render(batch, camera) }
|
|
||||||
blendNormalStraightAlpha(batch)
|
blendNormalStraightAlpha(batch)
|
||||||
|
|
||||||
|
// background
|
||||||
|
batch.color = DEFAULT_BACKGROUNDCOL
|
||||||
|
Toolkit.fillArea(batch, 0, 0, width, height)
|
||||||
|
|
||||||
|
palette.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
|
||||||
// gaps between tabs and close button
|
// gaps between tabs and close button
|
||||||
batch.color = DEFAULT_BACKGROUNDCOL
|
batch.color = DEFAULT_BACKGROUNDCOL
|
||||||
Toolkit.fillArea(batch, 0f, tabs.height.toFloat(), MENUBAR_SIZE.toFloat(), height.toFloat() - (tabs.height + closeButton.height))
|
Toolkit.fillArea(batch, 0f, tabs.height.toFloat(), MENUBAR_SIZE.toFloat(), height.toFloat() - (tabs.height + closeButton.height))
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import net.torvald.terrarum.ui.UICanvas
|
|||||||
/**
|
/**
|
||||||
* Created by minjaesong on 2018-12-08.
|
* Created by minjaesong on 2018-12-08.
|
||||||
*/
|
*/
|
||||||
class UIProxyNewBuildingMaker : UICanvas() {
|
class UIProxyNewBuildingMaker(val remoCon: UIRemoCon) : UICanvas() {
|
||||||
|
|
||||||
override var width: Int = 0
|
override var width: Int = 0
|
||||||
override var height: Int = 0
|
override var height: Int = 0
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.ui
|
package net.torvald.terrarum.modulebasegame.ui
|
||||||
|
|
||||||
|
import net.torvald.terrarum.App
|
||||||
import net.torvald.terrarum.Yaml
|
import net.torvald.terrarum.Yaml
|
||||||
|
|
||||||
|
|
||||||
@@ -32,6 +33,10 @@ object UITitleRemoConYaml {
|
|||||||
- MENU_LABEL_QUIT
|
- MENU_LABEL_QUIT
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
val menuBaseDev = """
|
||||||
|
- MENU_MODE_BUILDINGMAKER : net.torvald.terrarum.modulebasegame.ui.UIProxyNewBuildingMaker
|
||||||
|
""" + menuBase
|
||||||
|
|
||||||
val menuWithSavefile = """
|
val menuWithSavefile = """
|
||||||
- MENU_LABEL_CONTINUE : net.torvald.terrarum.modulebasegame.ui.UIProxyLoadLatestSave
|
- MENU_LABEL_CONTINUE : net.torvald.terrarum.modulebasegame.ui.UIProxyLoadLatestSave
|
||||||
"""
|
"""
|
||||||
@@ -57,6 +62,6 @@ object UITitleRemoConYaml {
|
|||||||
|
|
||||||
operator fun invoke(hasSave: Boolean) =
|
operator fun invoke(hasSave: Boolean) =
|
||||||
// Yaml((if (hasSave) menuWithSavefile else menuNewGame) + menuBase).parse()
|
// Yaml((if (hasSave) menuWithSavefile else menuNewGame) + menuBase).parse()
|
||||||
Yaml(menuBase).parse()
|
Yaml(if (App.IS_DEVELOPMENT_BUILD) menuBaseDev else menuBase).parse()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,8 @@ import com.badlogic.gdx.graphics.Camera
|
|||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
import net.torvald.terrarum.BlendMode
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.Second
|
|
||||||
import net.torvald.terrarum.Terrarum
|
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.toInt
|
|
||||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +49,10 @@ class UIItemTextButtonList(
|
|||||||
|
|
||||||
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.CENTRE,
|
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.CENTRE,
|
||||||
val itemHitboxSize: Int = lineHeight,
|
val itemHitboxSize: Int = lineHeight,
|
||||||
tagsCollection: Array<Array<String>> = Array(labelsList.size) { arrayOf("") }
|
|
||||||
|
tagsCollection: Array<Array<String>> = Array(labelsList.size) { arrayOf("") },
|
||||||
|
|
||||||
|
val backgroundCol: Color = Color(0),
|
||||||
) : UIItem(parentUI, initialX, initialY) {
|
) : UIItem(parentUI, initialX, initialY) {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -238,6 +238,11 @@ class UIItemTextButtonList(
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
batch.color = backgroundCol
|
||||||
|
blendNormalStraightAlpha(batch)
|
||||||
|
Toolkit.fillArea(batch, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
|
||||||
|
|
||||||
|
|
||||||
buttons.forEach { it.render(batch, camera) }
|
buttons.forEach { it.render(batch, camera) }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -101,16 +101,16 @@ class UINSMenu(
|
|||||||
val listHeight = stringsFromTree.size * LINE_HEIGHT
|
val listHeight = stringsFromTree.size * LINE_HEIGHT
|
||||||
|
|
||||||
val list = UIItemTextButtonList(
|
val list = UIItemTextButtonList(
|
||||||
this,
|
this,
|
||||||
UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
|
UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
|
||||||
stringsFromTree,
|
stringsFromTree,
|
||||||
width, LINE_HEIGHT,
|
width, LINE_HEIGHT,
|
||||||
uiWidth, listHeight,
|
uiWidth, listHeight,
|
||||||
textAreaWidth = listWidth,
|
textAreaWidth = listWidth,
|
||||||
alignment = UIItemTextButton.Companion.Alignment.LEFT,
|
alignment = UIItemTextButton.Companion.Alignment.LEFT,
|
||||||
inactiveCol = Color(.94f, .94f, .94f, 1f),
|
inactiveCol = Color(.94f, .94f, .94f, 1f),
|
||||||
itemHitboxSize = LINE_HEIGHT
|
itemHitboxSize = LINE_HEIGHT,
|
||||||
|
backgroundCol = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL
|
||||||
)
|
)
|
||||||
|
|
||||||
// List selection change listener
|
// List selection change listener
|
||||||
|
|||||||
Reference in New Issue
Block a user