Basic config screen

This commit is contained in:
nelle 2023-10-29 02:30:51 -06:00
parent ccba59e2ba
commit 1af074ab92
2 changed files with 46 additions and 1 deletions

View file

@ -0,0 +1,45 @@
package group.ouroboros.potrogue.view
import group.ouroboros.potrogue.GameConfig
import org.hexworks.zircon.api.ComponentDecorations
import org.hexworks.zircon.api.Components
import org.hexworks.zircon.api.component.ColorTheme
import org.hexworks.zircon.api.component.ComponentAlignment
import org.hexworks.zircon.api.grid.TileGrid
import org.hexworks.zircon.api.view.base.BaseView
class ConfigView (private val grid: TileGrid, theme: ColorTheme = GameConfig.THEME) : BaseView(grid, theme) {
init {
val msg = "Pre-Game Configuration"
// a text box can hold headers, paragraphs and list items
// `contentWidth = ` here is a so-called keyword parameter
// using them you can pass parameters not by their order
// but by their name.
// this might be familiar for Python programmers
val header = Components.textBox(contentWidth = msg.length)
// we add a header
.addHeader(msg)
// and a new line
.addNewLine()
// and align it to center
.withAlignmentWithin(screen, ComponentAlignment.TOP_CENTER)
.build() // finally we build the component
//TODO: Options: world size, character tile (smiley, @, &), character customizations (class, looks, stats, start),
val backButton = Components.button()
.withAlignmentWithin(screen, ComponentAlignment.BOTTOM_CENTER)
.withText("BACK")
.withDecorations(ComponentDecorations.box(), ComponentDecorations.shadow())
.build()
//Once the back button is activated go back to startView
backButton.onActivated {
replaceWith(StartView(grid))
}
// We can add multiple components at once
//Bake The Cake
screen.addComponents(header,backButton)
}}

View file

@ -57,7 +57,7 @@ class StartView (private val grid: TileGrid, theme: ColorTheme = GameConfig.THEM
}
configButton.onActivated {
TODO()
replaceWith(ConfigView(grid))
}
exitButton.onActivated {