添加游戏结束按钮
This commit is contained in:
@@ -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))
|
||||
|
Reference in New Issue
Block a user