fix: correct core sepration for the gui and the tui, gui no longer in a seperate module

This commit is contained in:
shahdlala66
2026-04-01 08:52:59 +02:00
committed by Janis
parent 23a5c763c5
commit 395318909b
24 changed files with 30 additions and 90 deletions
-76
View File
@@ -1,76 +0,0 @@
plugins {
id("scala")
id("org.scoverage") version "8.1"
application
}
group = "de.nowchess"
version = "1.0-SNAPSHOT"
@Suppress("UNCHECKED_CAST")
val versions = rootProject.extra["VERSIONS"] as Map<String, String>
repositories {
mavenCentral()
}
scala {
scalaVersion = versions["SCALA3"]!!
}
scoverage {
scoverageVersion.set(versions["SCOVERAGE"]!!)
}
dependencies {
implementation("org.scala-lang:scala3-compiler_3") {
version {
strictly(versions["SCALA3"]!!)
}
}
implementation("org.scala-lang:scala3-library_3") {
version {
strictly(versions["SCALA3"]!!)
}
}
implementation(project(":modules:core"))
implementation(project(":modules:api"))
// ScalaFX dependencies
implementation("org.scalafx:scalafx_3:21.0.0-R32")
// JavaFX dependencies for the current platform
val javaFXVersion = "21.0.1"
val osName = System.getProperty("os.name").lowercase()
val platform = when {
osName.contains("win") -> "win"
osName.contains("mac") -> "mac"
osName.contains("linux") -> "linux"
else -> "linux"
}
listOf("base", "controls", "graphics", "media").forEach { module ->
implementation("org.openjfx:javafx-$module:$javaFXVersion:$platform")
}
testImplementation(platform("org.junit:junit-bom:5.13.4"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.scalatest:scalatest_3:${versions["SCALATEST"]!!}")
testImplementation("co.helmethair:scalatest-junit-runner:${versions["SCALATEST_JUNIT"]!!}")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.test {
useJUnitPlatform {
includeEngines("scalatest")
testLogging {
events("passed", "skipped", "failed")
}
}
finalizedBy(tasks.reportScoverage)
}
tasks.reportScoverage {
dependsOn(tasks.test)
}
+17 -1
View File
@@ -50,7 +50,23 @@ dependencies {
implementation(project(":modules:core"))
implementation(project(":modules:api"))
implementation(project(":modules:gui"))
// ScalaFX dependencies
implementation("org.scalafx:scalafx_3:21.0.0-R32")
// JavaFX dependencies for the current platform
val javaFXVersion = "21.0.1"
val osName = System.getProperty("os.name").lowercase()
val platform = when {
osName.contains("win") -> "win"
osName.contains("mac") -> "mac"
osName.contains("linux") -> "linux"
else -> "linux"
}
listOf("base", "controls", "graphics", "media").forEach { module ->
implementation("org.openjfx:javafx-$module:$javaFXVersion:$platform")
}
testImplementation(platform("org.junit:junit-bom:5.13.4"))
testImplementation("org.junit.jupiter:junit-jupiter")

Before

Width:  |  Height:  |  Size: 161 B

After

Width:  |  Height:  |  Size: 161 B

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 188 B

Before

Width:  |  Height:  |  Size: 286 B

After

Width:  |  Height:  |  Size: 286 B

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

Before

Width:  |  Height:  |  Size: 266 B

After

Width:  |  Height:  |  Size: 266 B

Before

Width:  |  Height:  |  Size: 297 B

After

Width:  |  Height:  |  Size: 297 B

Before

Width:  |  Height:  |  Size: 258 B

After

Width:  |  Height:  |  Size: 258 B

Before

Width:  |  Height:  |  Size: 263 B

After

Width:  |  Height:  |  Size: 263 B

Before

Width:  |  Height:  |  Size: 313 B

After

Width:  |  Height:  |  Size: 313 B

Before

Width:  |  Height:  |  Size: 251 B

After

Width:  |  Height:  |  Size: 251 B

Before

Width:  |  Height:  |  Size: 275 B

After

Width:  |  Height:  |  Size: 275 B

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 281 B

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

@@ -2,7 +2,7 @@ package de.nowchess.ui
import de.nowchess.chess.engine.GameEngine
import de.nowchess.ui.terminal.TerminalUI
import de.nowchess.gui.ChessGUILauncher
import de.nowchess.ui.gui.ChessGUILauncher
/** Application entry point - starts both GUI and Terminal UI for the chess game.
* Both views subscribe to the same GameEngine via Observer pattern.
@@ -1,4 +1,4 @@
package de.nowchess.gui
package de.nowchess.ui.gui
import scalafx.Includes.*
import scalafx.application.Platform
@@ -14,7 +14,7 @@ import de.nowchess.api.move.PromotionPiece
import de.nowchess.chess.engine.GameEngine
/** ScalaFX chess board view that displays the game state.
* Uses Arabian chess sprites and color palette.
* Uses chess sprites and color palette.
* Handles user interactions (clicks) and sends moves to GameEngine.
*/
class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends BorderPane:
@@ -22,7 +22,7 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
private val squareSize = 70.0
private val boardGrid = new GridPane()
private val messageLabel = new Label {
text = "Welcome to Arabian Chess!"
text = "Welcome!"
font = Font.font("Comic Sans MS", 16)
padding = Insets(10)
}
@@ -41,7 +41,7 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
alignment = Pos.Center
children = Seq(
new Label {
text = "Arabian Chess"
text = "Chess"
font = Font.font("Comic Sans MS", 24)
style = "-fx-font-weight: bold;"
},
@@ -1,4 +1,4 @@
package de.nowchess.gui
package de.nowchess.ui.gui
import javafx.application.{Application => JFXApplication, Platform => JFXPlatform}
import javafx.stage.Stage as JFXStage
@@ -7,7 +7,7 @@ import scalafx.scene.Scene
import scalafx.stage.Stage
import de.nowchess.chess.engine.GameEngine
/** ScalaFX GUI Application for Arabian Chess.
/** ScalaFX GUI Application for Chess.
* This is launched from Main alongside the TUI.
* Both subscribe to the same GameEngine via Observer pattern.
*/
@@ -17,7 +17,7 @@ class ChessGUIApp extends JFXApplication:
val engine = ChessGUILauncher.getEngine
val stage = new Stage(primaryStage)
stage.title = "Arabian Chess"
stage.title = "Chess"
stage.width = 700
stage.height = 800
stage.resizable = false
@@ -1,4 +1,4 @@
package de.nowchess.gui
package de.nowchess.ui.gui
import scalafx.application.Platform
import scalafx.scene.control.Alert
@@ -1,9 +1,9 @@
package de.nowchess.gui
package de.nowchess.ui.gui
import scalafx.scene.image.{Image, ImageView}
import de.nowchess.api.board.{Piece, PieceType, Color}
/** Utility object for loading Arabian chess piece sprites. */
/** Utility object for loading chess piece sprites. */
object PieceSprites:
private val spriteCache = scala.collection.mutable.Map[String, Image]()
@@ -29,7 +29,7 @@ object PieceSprites:
throw new RuntimeException(s"Could not load sprite: $path")
new Image(stream)
/** Get square colors for the board using Arabian theme. */
/** Get square colors for the board using theme. */
object SquareColors:
val White = "#F3C8A0" // Warm light beige
val Black = "#BA6D4B" // Warm terracotta
+1 -1
View File
@@ -1,2 +1,2 @@
rootProject.name = "NowChessSystems"
include("modules:core", "modules:api", "modules:ui", "modules:gui")
include("modules:core", "modules:api", "modules:ui")