diff --git a/build.gradle.kts b/build.gradle.kts index c106048..9f0961c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,10 +5,12 @@ val slf4j_version: String by project val junit_version: String by project val mockito_version: String by project val assertj_version: String by project +val game_name: String by project +val version: String by project plugins { - kotlin("jvm") version "1.4.10" - id("com.github.johnrengelman.shadow") version "5.2.0" + kotlin("jvm") version "1.9.10" + id("com.github.johnrengelman.shadow") version "8.1.1" } repositories { @@ -18,8 +20,8 @@ repositories { } java { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_20 + targetCompatibility = JavaVersion.VERSION_20 } dependencies { @@ -38,10 +40,10 @@ dependencies { tasks { named("shadowJar") { - archiveBaseName.set("potroge") + archiveBaseName.set("$game_name + $version") mergeServiceFiles() manifest { - attributes(mapOf("Main-Class" to "com.example.MainKt")) + attributes(mapOf("Main-Class" to "group.ouroboros.potrogue.MainKt")) } } } @@ -54,7 +56,7 @@ tasks { val jar by tasks.getting(Jar::class) { manifest { - attributes["Main-Class"] = "com.example.MainKt" + attributes["Main-Class"] = "group.ouroboros.potrogue.MainKt" } } diff --git a/gradle.properties b/gradle.properties index 05fa72b..209fc96 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,5 @@ assertj_version=3.6.2 slf4j_version=1.7.25 group=group.ouroboros.potrogue +game_name=potrogue version=0.1.0-DEV diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 14e30f7..fce403e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/group/ouroboros/potrogue/view/LoseView.kt b/src/main/kotlin/group/ouroboros/potrogue/view/LoseView.kt new file mode 100644 index 0000000..8022144 --- /dev/null +++ b/src/main/kotlin/group/ouroboros/potrogue/view/LoseView.kt @@ -0,0 +1,42 @@ +package group.ouroboros.potrogue.view + + +import group.ouroboros.potrogue.GAME_THEME +import org.hexworks.zircon.api.ComponentDecorations.box +import org.hexworks.zircon.api.Components +import org.hexworks.zircon.api.component.ComponentAlignment +import org.hexworks.zircon.api.grid.TileGrid +import org.hexworks.zircon.api.view.base.BaseView +import kotlin.system.exitProcess + +class LoseView (private val grid: TileGrid) : BaseView(grid, GAME_THEME) { + + init { + val header = Components.header() + .withText("Game Over") + .withAlignmentWithin(screen, ComponentAlignment.CENTER) + .build() + + val restartButton = Components.button() + .withAlignmentAround(header, ComponentAlignment.BOTTOM_LEFT) + .withText("Restart") + .withDecorations(box()) + .build() + + val exitButton = Components.button() + .withAlignmentAround(header, ComponentAlignment.BOTTOM_RIGHT) + .withText("Quit") + .withDecorations(box()) + .build() + + restartButton.onActivated { + replaceWith(PlayView(grid)) + } + + exitButton.onActivated { + exitProcess(0) + } + + screen.addComponents(header, restartButton, exitButton) + } +} \ No newline at end of file diff --git a/src/main/kotlin/group/ouroboros/potrogue/view/PlayView.kt b/src/main/kotlin/group/ouroboros/potrogue/view/PlayView.kt index 434feda..be400f6 100644 --- a/src/main/kotlin/group/ouroboros/potrogue/view/PlayView.kt +++ b/src/main/kotlin/group/ouroboros/potrogue/view/PlayView.kt @@ -1,6 +1,6 @@ package group.ouroboros.potrogue.view -import org.hexworks.zircon.api.ColorThemes +import group.ouroboros.potrogue.GAME_THEME import org.hexworks.zircon.api.ComponentDecorations.box import org.hexworks.zircon.api.ComponentDecorations.shadow import org.hexworks.zircon.api.Components @@ -9,7 +9,7 @@ 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()) { +class PlayView (private val grid: TileGrid) : BaseView(grid, GAME_THEME) { init { val loseButton = Components.button() // constants like LEFT_CENTER can also be imported for brevity @@ -24,6 +24,9 @@ class PlayView (private val grid: TileGrid) : BaseView(grid, ColorThemes.arc()) .withDecorations(box(), shadow()) .build() + winButton.onActivated { replaceWith(WinView(grid)) } + loseButton.onActivated { replaceWith(LoseView(grid)) } + // multiple components can be added once screen.addComponents(loseButton, winButton) } diff --git a/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt b/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt index 9307ea7..fd59917 100644 --- a/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt +++ b/src/main/kotlin/group/ouroboros/potrogue/view/StartView.kt @@ -39,7 +39,7 @@ class StartView (private val grid: TileGrid) : BaseView(grid, GAME_THEME) { //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 { replaceWith(PlayView(grid)) } diff --git a/src/main/kotlin/group/ouroboros/potrogue/view/WinView.kt b/src/main/kotlin/group/ouroboros/potrogue/view/WinView.kt new file mode 100644 index 0000000..917bfd6 --- /dev/null +++ b/src/main/kotlin/group/ouroboros/potrogue/view/WinView.kt @@ -0,0 +1,43 @@ +package group.ouroboros.potrogue.view + +import group.ouroboros.potrogue.GAME_THEME +import org.hexworks.zircon.api.ColorThemes +import org.hexworks.zircon.api.ComponentDecorations.box +import org.hexworks.zircon.api.Components +import org.hexworks.zircon.api.component.ComponentAlignment +import org.hexworks.zircon.api.grid.TileGrid +import org.hexworks.zircon.api.view.base.BaseView +import kotlin.system.exitProcess + +// For if winning.... obviously just a test. +class WinView (private val grid: TileGrid) : BaseView(grid, GAME_THEME) { + + init { + val header = Components.header() + .withText("You won!") + .withAlignmentWithin(screen, ComponentAlignment.CENTER) + .build() + + val restartButton = Components.button() + .withAlignmentAround(header, ComponentAlignment.BOTTOM_LEFT) + .withText("Restart") + .withDecorations(box()) + .build() + + val exitButton = Components.button() + .withAlignmentAround(header, ComponentAlignment.BOTTOM_RIGHT) + .withText("Quit") + .withDecorations(box()) + .build() + + restartButton.onActivated { + replaceWith(PlayView(grid)) + } + + exitButton.onActivated { + exitProcess(0) + } + + screen.addComponents(header, restartButton, exitButton) + } +} \ No newline at end of file