添加游戏结束按钮

This commit is contained in:
2024-12-24 09:25:44 +08:00
parent eba8a2fc62
commit b653ee2eee

View File

@@ -36,6 +36,7 @@ struct ContentView: View {
@State private var playerHasWon = false
var body: some View {
ZStack(alignment: .topTrailing) {
HStack(spacing: 0) {
PlayerButton(gameState: gameState, score: player1Score, color: .blue, onSelect: selectPlayer1)
@@ -56,6 +57,16 @@ struct ContentView: View {
PlayerButton(gameState: gameState, score: player2Score, color: .red, onSelect: selectPlayer2)
}
Button("End Game", systemImage: "xmark.circle") {
isGameActive = false
}
.symbolVariant(.fill)
.labelStyle(.iconOnly)
.font(.largeTitle)
.tint(.white)
.padding(40)
}
.ignoresSafeArea()
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(white: 0.9))