feat: NCS-17 Implement basic ScalaFX UI #14

Merged
Janis merged 12 commits from feat/NCS-17-Implement-ScalaFX-UI into main 2026-04-01 22:48:30 +02:00
Showing only changes of commit 136b586553 - Show all commits
@@ -23,10 +23,11 @@ import de.nowchess.chess.notation.{FenExporter, FenParser, PgnExporter, PgnParse
class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends BorderPane:
private val squareSize = 70.0
private val comicSansFontFamily = "Comic Sans MS"
private val boardGrid = new GridPane()
private val messageLabel = new Label {
text = "Welcome!"
font = Font.font("Comic Sans MS", 16)
font = Font.font(comicSansFontFamily, 16)
padding = Insets(10)
}
@@ -45,7 +46,7 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
children = Seq(
new Label {
text = "Chess"
font = Font.font("Comic Sans MS", 24)
font = Font.font(comicSansFontFamily, 24)
style = "-fx-font-weight: bold;"
},
messageLabel
@@ -69,17 +70,17 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
alignment = Pos.Center
children = Seq(
new Button("Undo") {
font = Font.font("Comic Sans MS", 12)
font = Font.font(comicSansFontFamily, 12)
onAction = _ => if engine.canUndo then engine.undo()
style = "-fx-background-radius: 8; -fx-background-color: #B9DAD1;"
},
new Button("Redo") {
font = Font.font("Comic Sans MS", 12)
font = Font.font(comicSansFontFamily, 12)
onAction = _ => if engine.canRedo then engine.redo()
style = "-fx-background-radius: 8; -fx-background-color: #B9C2DA;"
},
new Button("Reset") {
font = Font.font("Comic Sans MS", 12)
font = Font.font(comicSansFontFamily, 12)
onAction = _ => engine.reset()
style = "-fx-background-radius: 8; -fx-background-color: #E1EAA9;"
}
@@ -90,22 +91,22 @@ class ChessBoardView(val stage: Stage, private val engine: GameEngine) extends B
alignment = Pos.Center
children = Seq(
new Button("FEN Export") {
font = Font.font("Comic Sans MS", 12)
font = Font.font(comicSansFontFamily, 12)
onAction = _ => doFenExport()
style = "-fx-background-radius: 8; -fx-background-color: #DAC4B9;"
},
new Button("FEN Import") {
font = Font.font("Comic Sans MS", 12)
font = Font.font(comicSansFontFamily, 12)
onAction = _ => doFenImport()
style = "-fx-background-radius: 8; -fx-background-color: #DAD4B9;"
},
new Button("PGN Export") {
font = Font.font("Comic Sans MS", 12)
font = Font.font(comicSansFontFamily, 12)
onAction = _ => doPgnExport()
style = "-fx-background-radius: 8; -fx-background-color: #C4DAB9;"
},
new Button("PGN Import") {
font = Font.font("Comic Sans MS", 12)
font = Font.font(comicSansFontFamily, 12)
onAction = _ => doPgnImport()
style = "-fx-background-radius: 8; -fx-background-color: #B9DAC4;"
}