Skip to content

Commit 7111d4d

Browse files
author
Louise P
committed
[Update]: Update Buttons return in option & in game
1 parent f474cb4 commit 7111d4d

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

Meep/Meep/GameView.swift

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ import SwiftUI
1010
import SpriteKit
1111

1212
struct GameView: View {
13+
14+
@State var menuView: Bool = false
15+
1316
var body: some View {
14-
ZStack {
15-
SpriteKitInterface(scene: HistoryScene(level: "Reverse"))
16-
Button(action: { NSApplication.shared.terminate(self) }, label: { Image(systemName: "xmark") })
17-
.buttonStyle(PlainButtonStyle())
18-
.imageScale(.large)
19-
.foregroundColor(.red)
20-
.position(x: 30, y: 30)
17+
if menuView {
18+
MenuView()
19+
} else {
20+
ZStack {
21+
SpriteKitInterface(scene: HistoryScene(level: "Reverse"))
22+
Button(action: { menuView.self.toggle() }, label: { Image(systemName: "xmark") })
23+
.buttonStyle(PlainButtonStyle())
24+
.imageScale(.large)
25+
.foregroundColor(.red)
26+
.position(x: 30, y: 30)
27+
}
2128
}
2229
}
2330
}

Meep/Meep/OptionView.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,19 @@ struct OptionView: View {
2121
NavigationView {
2222
HStack {
2323
List {
24-
Button(action: { self.menuView.toggle() }, label: { Text("<< Menu") }).buttonStyle(PlainButtonStyle())
24+
25+
Button(action: {
26+
self.menuView.toggle()
27+
28+
}, label: {
29+
Image(systemName: "chevron.left.2")
30+
Text("Return")
31+
})
32+
.buttonStyle(PlainButtonStyle())
33+
.foregroundColor(.red)
34+
2535
NavigationLink(destination: KeysView(), label: { Text("Keys") })
36+
2637
}.listStyle(SidebarListStyle())
2738
.font(.largeTitle)
2839
}

0 commit comments

Comments
 (0)