diff --git a/src/main/kotlin/group/ouroboros/potrogue/view/PlayView.kt b/src/main/kotlin/group/ouroboros/potrogue/view/PlayView.kt new file mode 100644 index 0000000..434feda --- /dev/null +++ b/src/main/kotlin/group/ouroboros/potrogue/view/PlayView.kt @@ -0,0 +1,30 @@ +package group.ouroboros.potrogue.view + +import org.hexworks.zircon.api.ColorThemes +import org.hexworks.zircon.api.ComponentDecorations.box +import org.hexworks.zircon.api.ComponentDecorations.shadow +import org.hexworks.zircon.api.Components +import org.hexworks.zircon.api.component.ComponentAlignment.LEFT_CENTER +import org.hexworks.zircon.api.component.ComponentAlignment.RIGHT_CENTER +import org.hexworks.zircon.api.grid.TileGrid +import org.hexworks.zircon.api.view.base.BaseView + +class PlayView (private val grid: TileGrid) : BaseView(grid, ColorThemes.arc()) { + init { + val loseButton = Components.button() + // constants like LEFT_CENTER can also be imported for brevity + .withAlignmentWithin(screen, LEFT_CENTER) + .withText("Lose!") + .withDecorations(box(), shadow()) + .build() + + val winButton = Components.button() + .withAlignmentWithin(screen, RIGHT_CENTER) + .withText("Win!") + .withDecorations(box(), shadow()) + .build() + + // multiple components can be added once + screen.addComponents(loseButton, winButton) + } +} \ No newline at end of file diff --git a/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt b/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt index ab035b7..36ca6f8 100644 --- a/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt +++ b/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt @@ -37,6 +37,12 @@ class StartView (private val grid: TileGrid) : BaseView(grid, GAME_THEME) { .withDecorations(box(), shadow()) .build() + // Once the start button is pressed, move on to the PlayView + //TODO move this on to a configuration screen for world/player customization before PlayView, for now basic gameplay is in order though. + startButton.onActivated { + replaceWith(PlayView(grid)) + } + // We can add multiple components at once screen.addComponents(header, startButton) }