diff --git a/.DS_Store b/.DS_Store index 1467c31..cccd18a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/ArkitDoushiQi/.DS_Store b/ArkitDoushiQi/.DS_Store index f39ec85..6dbb068 100644 Binary files a/ArkitDoushiQi/.DS_Store and b/ArkitDoushiQi/.DS_Store differ diff --git a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj index c1b333f..e1fce81 100644 --- a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj +++ b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj @@ -24,6 +24,10 @@ C24659E92BF60FAA004E80D5 /* ButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */; }; C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */; }; C25220F32C00AF490026B71F /* EditComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220F22C00AF490026B71F /* EditComponent.swift */; }; + C2F394062C045E800070B4F6 /* DSQ.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = C2F4176D2BFE2FBD00CFF0B3 /* DSQ.xcframework */; }; + C2F394082C0462400070B4F6 /* PhotoButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */; }; + C2F3940B2C0463940070B4F6 /* ProfileComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */; }; + C2F3940E2C04643A0070B4F6 /* GameView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F3940D2C04643A0070B4F6 /* GameView.swift */; }; C2F417702BFE2FBE00CFF0B3 /* howto.md in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176C2BFE2FBD00CFF0B3 /* howto.md */; }; C2F417722BFE2FBE00CFF0B3 /* capture.png in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176E2BFE2FBD00CFF0B3 /* capture.png */; }; C2F417732BFE2FBE00CFF0B3 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = C2F4176F2BFE2FBD00CFF0B3 /* README.md */; }; @@ -67,6 +71,9 @@ C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonComponent.swift; sourceTree = ""; }; C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameParametersMenuView.swift; sourceTree = ""; }; C25220F22C00AF490026B71F /* EditComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditComponent.swift; sourceTree = ""; }; + C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoButtonComponent.swift; sourceTree = ""; }; + C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileComponent.swift; sourceTree = ""; }; + C2F3940D2C04643A0070B4F6 /* GameView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameView.swift; sourceTree = ""; }; C2F4176C2BFE2FBD00CFF0B3 /* howto.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = howto.md; sourceTree = ""; }; C2F4176D2BFE2FBD00CFF0B3 /* DSQ.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = DSQ.xcframework; sourceTree = ""; }; C2F4176E2BFE2FBD00CFF0B3 /* capture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = capture.png; sourceTree = ""; }; @@ -78,6 +85,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + C2F394062C045E800070B4F6 /* DSQ.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -151,6 +159,7 @@ C205A2BC2BF373380097BD93 /* Views */ = { isa = PBXGroup; children = ( + C2F3940C2C0464260070B4F6 /* Game */, C25220F02C00AD7F0026B71F /* Components */, C25220EC2C00AC530026B71F /* GameParametersMenu */, C25220EB2C00A9230026B71F /* GeneralParametersMenu */, @@ -205,6 +214,7 @@ C25220F02C00AD7F0026B71F /* Components */ = { isa = PBXGroup; children = ( + C2F394092C04636C0070B4F6 /* Visuals */, C25220F12C00ADF70026B71F /* Controls */, ); path = Components; @@ -217,10 +227,27 @@ C20310D92BFCC8600031657D /* ToggleComponent.swift */, C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */, C25220F22C00AF490026B71F /* EditComponent.swift */, + C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */, ); path = Controls; sourceTree = ""; }; + C2F394092C04636C0070B4F6 /* Visuals */ = { + isa = PBXGroup; + children = ( + C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */, + ); + path = Visuals; + sourceTree = ""; + }; + C2F3940C2C0464260070B4F6 /* Game */ = { + isa = PBXGroup; + children = ( + C2F3940D2C04643A0070B4F6 /* GameView.swift */, + ); + path = Game; + sourceTree = ""; + }; C2F4176A2BFE2F8C00CFF0B3 /* Model */ = { isa = PBXGroup; children = ( @@ -376,9 +403,12 @@ C205A2B92BF373360097BD93 /* ContentView.swift in Sources */, 82F9D3312BFE3A9F009EDFAF /* HistoryGameDetail.swift in Sources */, C24659E92BF60FAA004E80D5 /* ButtonComponent.swift in Sources */, + C2F394082C0462400070B4F6 /* PhotoButtonComponent.swift in Sources */, + C2F3940E2C04643A0070B4F6 /* GameView.swift in Sources */, C24659E52BF5FE09004E80D5 /* MainMenu.swift in Sources */, 82F9D3362BFE3B3C009EDFAF /* HistoryView.swift in Sources */, C20310D82BFCC2410031657D /* GeneralParametersMenuView.swift in Sources */, + C2F3940B2C0463940070B4F6 /* ProfileComponent.swift in Sources */, C205A2B72BF373360097BD93 /* ArkitDoushiQiApp.swift in Sources */, C25220F32C00AF490026B71F /* EditComponent.swift in Sources */, C20310D62BFCB5FB0031657D /* PickerComponent.swift in Sources */, diff --git a/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift b/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift index 270b422..b42874f 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/ArkitDoushiQiApp.swift @@ -12,7 +12,7 @@ struct ArkitDoushiQiApp: App { @AppStorage("isDarkMode") private var isDarkMode = false var body: some Scene { WindowGroup { - ContentView() + MainMenu(playButtonText: "Jouer", registeredGamesButtonText: "Parties enregistrées",ParametersButtontText: "Paramètres") .preferredColorScheme(isDarkMode ? .dark : .light) } } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PhotoButtonComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PhotoButtonComponent.swift new file mode 100644 index 0000000..a4011fd --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/PhotoButtonComponent.swift @@ -0,0 +1,73 @@ +// +// PhotoButtonComponent.swift +// ArkitDoushiQi +// +// Created by Johan LACHENAL on 27/05/2024. +// + +import SwiftUI + +class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { + var picker: accessCameraView + + init(picker: accessCameraView) { + self.picker = picker + } + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + guard let selectedImage = info[.originalImage] as? UIImage else { return } + self.picker.selectedImage = selectedImage + self.picker.isPresented.wrappedValue.dismiss() + } +} + +struct accessCameraView: UIViewControllerRepresentable { + + @Binding var selectedImage: UIImage? + @Environment(\.presentationMode) var isPresented + + func makeUIViewController(context: Context) -> UIImagePickerController { + let imagePicker = UIImagePickerController() + imagePicker.sourceType = .camera + imagePicker.allowsEditing = true + imagePicker.delegate = context.coordinator + return imagePicker + } + + func updateUIViewController(_ uiViewController: UIImagePickerController, context: Context) { + + } + + func makeCoordinator() -> Coordinator { + return Coordinator(picker: self) + } +} + +struct PhotoButtonComponent: View { + let Text : String + @State private var showCamera = false + @State private var selectedImage: UIImage? + @State var image: UIImage? + var body: some View { + VStack { + if let selectedImage{ + Image(uiImage: selectedImage) + .resizable() + .scaledToFit() + } + + Button("Open camera") { + self.showCamera.toggle() + } + .fullScreenCover(isPresented: self.$showCamera) { + accessCameraView(selectedImage: self.$selectedImage) + } + } + } +} + +struct PhotoButtonComponent_Previews: PreviewProvider { + static var previews: some View { + PhotoButtonComponent(Text : "Prendre Photo") + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift new file mode 100644 index 0000000..4f12d75 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift @@ -0,0 +1,20 @@ +// +// ProfileComponent.swift +// ArkitDoushiQi +// +// Created by Johan LACHENAL on 27/05/2024. +// + +import SwiftUI + +struct ProfileComponent: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct ProfileComponent_Previews: PreviewProvider { + static var previews: some View { + ProfileComponent() + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Game/GameView.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Game/GameView.swift new file mode 100644 index 0000000..dd07a44 --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Game/GameView.swift @@ -0,0 +1,20 @@ +// +// GameView.swift +// ArkitDoushiQi +// +// Created by Johan LACHENAL on 27/05/2024. +// + +import SwiftUI + +struct GameView: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct GameView_Previews: PreviewProvider { + static var previews: some View { + GameView() + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift index b7ba71c..4bd66a4 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift @@ -1,29 +1,55 @@ -//// -//// GameParametersMenuView.swift -//// ArkitDoushiQi -//// -//// Created by Johan LACHENAL on 24/05/2024. -//// // -//import SwiftUI +// GameParametersMenuView.swift +// ArkitDoushiQi // -//struct GameParametersMenuView: View { -//// enum Rules: String, CaseIterable, Identifiable, Hashable { -//// case Easy = "Simplifié" -//// case Regular = "Normal" -//// var id: String { self.rawValue } -//// } -// var body: some View { +// Created by Johan LACHENAL on 24/05/2024. // -//// PickerComponent(title: "Sélectionne les règles :", -//// selectedOption: $selectedRulesOption, -//// options: Rules.allCases) -// } -// -//} -// -//struct GameParametersMenuView_Previews: PreviewProvider { -// static var previews: some View { -// GameParametersMenuView() -// } -//} + +import SwiftUI +import PhotosUI + +enum AIT: String, CaseIterable, Identifiable, Hashable { + case RandomAction = "IA Random" + case EasyTrainedAI = "IA Facile" + case MediumTrainedAI = "IA Intermédiaire" + + var id: String { self.rawValue } +} + +enum Rules: String, CaseIterable, Identifiable, Hashable { + case Easy = "Simplifié" + case Regular = "Normal" + var id: String { self.rawValue } +} + +struct GameParametersMenuView: View { + @State private var selectedAIOption: AIT = .RandomAction + @State private var selectedRulesOption: Rules = .Regular + var body: some View { + NavigationView { + VStack(alignment: .leading) { + HStack(alignment: .center) { + Text("Paramètres de partie").bold().font(.title) + }.frame(maxWidth: .infinity) + PickerComponent(title: "Sélectionne les règles :", + selectedOption: $selectedRulesOption, + options: Rules.allCases) + PickerComponent(title: "Sélectionne une IA :", + selectedOption: $selectedAIOption, + options: AIT.allCases) + EditComponent(explanation: "Nom du joueur 1", value: "Joueur 1") + EditComponent(explanation: "Nom du joueur 2",value: "Joueur 2") + ButtonComponent(title: "Lancer la partie") { + GameView() + } + }.frame(maxHeight: .infinity, alignment: .top) + } + } + +} + +struct GameParametersMenuView_Previews: PreviewProvider { + static var previews: some View { + GameParametersMenuView() + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift index a9eb598..6a6de1b 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/GeneralParametersMenu/GeneralParametersMenuView.swift @@ -7,26 +7,12 @@ import SwiftUI -enum AIT: String, CaseIterable, Identifiable, Hashable { - case RandomAction = "IA Random" - case EasyTrainedAI = "IA Facile" - case MediumTrainedAI = "IA Intermédiaire" - - var id: String { self.rawValue } -} - enum Language: String, CaseIterable, Identifiable, Hashable { case French = "Français" case English = "English" var id: String { self.rawValue } } -enum Rules: String, CaseIterable, Identifiable, Hashable { - case Easy = "Simplifié" - case Regular = "Normal" - var id: String { self.rawValue } -} - struct GeneralParametersMenuView: View { @State private var selectedAIOption: AIT = .RandomAction @State private var selectedLanguageOption: Language = .French @@ -38,15 +24,9 @@ struct GeneralParametersMenuView: View { }.frame(maxWidth: .infinity) Spacer().frame(maxHeight: 30) ToggleComponent() - PickerComponent(title: "Sélectionne une IA :", - selectedOption: $selectedAIOption, - options: AIT.allCases) PickerComponent(title: "Sélectionne un langage :", selectedOption: $selectedLanguageOption, options: Language.allCases) - PickerComponent(title: "Sélectionne les règles :", - selectedOption: $selectedRulesOption, - options: Rules.allCases) }.frame(maxHeight: .infinity, alignment: .top) } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift index 39b4cf3..b1ce79c 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/MainMenu/MainMenu.swift @@ -26,7 +26,7 @@ struct MainMenu: View { Spacer().frame(height: 40) VStack(alignment: .leading) { ButtonComponent(title: playButtonText) - { Text("jeu page") } + { GameParametersMenuView() } Spacer().frame(height: 30) ButtonComponent(title: registeredGamesButtonText) { Text("parties enregistrées page") } diff --git a/ArkitDoushiQi/Model/.DS_Store b/ArkitDoushiQi/Model/.DS_Store new file mode 100644 index 0000000..5ec6b63 Binary files /dev/null and b/ArkitDoushiQi/Model/.DS_Store differ diff --git a/ArkitDoushiQi/Model/XCFramework/.DS_Store b/ArkitDoushiQi/Model/XCFramework/.DS_Store new file mode 100644 index 0000000..930cdde Binary files /dev/null and b/ArkitDoushiQi/Model/XCFramework/.DS_Store differ diff --git a/ArkitDoushiQi/Model/XCFramework/DSQ.xcframework/.DS_Store b/ArkitDoushiQi/Model/XCFramework/DSQ.xcframework/.DS_Store new file mode 100644 index 0000000..a6188c4 Binary files /dev/null and b/ArkitDoushiQi/Model/XCFramework/DSQ.xcframework/.DS_Store differ