Config and Exit buttons

This commit is contained in:
nelle 2023-10-28 19:11:50 -06:00
parent b2b3c74d94
commit bc6f6f38aa
2 changed files with 24 additions and 4 deletions

View file

@ -5,7 +5,7 @@ import group.ouroboros.potrogue.view.StartView
import org.hexworks.zircon.api.SwingApplications import org.hexworks.zircon.api.SwingApplications
//Important Values //Important Values
const val GAME_ID = "potrogue"; const val GAME_ID = "PotRogue";
const val GAME_VER = "0.1.0-DEV"; const val GAME_VER = "0.1.0-DEV";
fun main(args: Array<String>) { fun main(args: Array<String>) {

View file

@ -9,6 +9,7 @@ import org.hexworks.zircon.api.component.ColorTheme
import org.hexworks.zircon.api.component.ComponentAlignment import org.hexworks.zircon.api.component.ComponentAlignment
import org.hexworks.zircon.api.grid.TileGrid import org.hexworks.zircon.api.grid.TileGrid
import org.hexworks.zircon.api.view.base.BaseView import org.hexworks.zircon.api.view.base.BaseView
import kotlin.system.exitProcess
class StartView (private val grid: TileGrid, theme: ColorTheme = GameConfig.THEME) : BaseView(grid, theme) { class StartView (private val grid: TileGrid, theme: ColorTheme = GameConfig.THEME) : BaseView(grid, theme) {
init { init {
@ -37,15 +38,34 @@ class StartView (private val grid: TileGrid, theme: ColorTheme = GameConfig.THEM
.withDecorations(box(), shadow()) .withDecorations(box(), shadow())
.build() .build()
//TODO val configButton = Components.button()
//move this on to a configuration screen for world/player customization before PlayView, for now basic gameplay is in order though. .withAlignmentAround(startButton, ComponentAlignment.BOTTOM_CENTER)
.withText("CONFIG")
.withDecorations(box(), shadow())
.build()
val exitButton = Components.button()
.withAlignmentAround(configButton, ComponentAlignment.BOTTOM_CENTER)
.withText("EXIT")
.withDecorations(box(), shadow())
.build()
//TODO: move this on to a configuration screen for world/player customization before PlayView, for now basic gameplay is in order though.
//Once the start button is pressed, move on to the PlayView //Once the start button is pressed, move on to the PlayView
startButton.onActivated { startButton.onActivated {
replaceWith(PlayView(grid)) replaceWith(PlayView(grid))
} }
configButton.onActivated {
TODO()
}
exitButton.onActivated {
exitProcess(0)
}
// We can add multiple components at once // We can add multiple components at once
//Bake The Cake //Bake The Cake
screen.addComponents(header, startButton) screen.addComponents(header, startButton, configButton, exitButton)
} }
} }