mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
buildingmaker resurrection wip
This commit is contained in:
@@ -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
|
||||
|
||||
private val tabs = UIItemTextButtonList(
|
||||
this, 36, arrayOf("Terrain", "Wall", "Wire"),
|
||||
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
|
||||
defaultSelection = 0
|
||||
this, 36, arrayOf("Terrain", "Wall", "Wire"),
|
||||
0, 0, textAreaWidth = MENUBAR_SIZE, width = MENUBAR_SIZE,
|
||||
defaultSelection = 0,
|
||||
backgroundCol = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL
|
||||
)
|
||||
private val closeButton = UIItemTextButtonList(
|
||||
this, 36, arrayOf("Close"),
|
||||
0, this.height - UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
|
||||
width = MENUBAR_SIZE, textAreaWidth = MENUBAR_SIZE
|
||||
this, 36, arrayOf("Close"),
|
||||
0, this.height - UIItemTextButtonList.DEFAULT_LINE_HEIGHT,
|
||||
width = MENUBAR_SIZE, textAreaWidth = MENUBAR_SIZE,
|
||||
backgroundCol = UIItemTextButtonList.DEFAULT_BACKGROUNDCOL
|
||||
)
|
||||
|
||||
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(
|
||||
this, ItemCodex.getItemImage(prop.id)!!,
|
||||
initialX = MENUBAR_SIZE + (index % 16) * TILESREGION_SIZE,
|
||||
@@ -128,9 +137,15 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
||||
}
|
||||
|
||||
override fun renderUI(batch: SpriteBatch, camera: OrthographicCamera) {
|
||||
palette.forEach { it.render(batch, camera) }
|
||||
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
|
||||
batch.color = DEFAULT_BACKGROUNDCOL
|
||||
Toolkit.fillArea(batch, 0f, tabs.height.toFloat(), MENUBAR_SIZE.toFloat(), height.toFloat() - (tabs.height + closeButton.height))
|
||||
|
||||
Reference in New Issue
Block a user