diff --git a/.DS_Store b/.DS_Store index cccd18a..8112cff 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj index 20a11ba..107c71d 100644 --- a/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj +++ b/ArkitDoushiQi/ArkitDoushiQi.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ C24659E92BF60FAA004E80D5 /* ButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */; }; C24DAB5C2C061DC700681CD0 /* AI.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB5B2C061DC700681CD0 /* AI.swift */; }; C24DAB5E2C061E3A00681CD0 /* Language.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB5D2C061E3A00681CD0 /* Language.swift */; }; + C24DAB622C062DBC00681CD0 /* ProfileEdit.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24DAB612C062DBC00681CD0 /* ProfileEdit.swift */; }; C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220ED2C00AC7E0026B71F /* GameParametersMenuView.swift */; }; C25220F32C00AF490026B71F /* EditComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C25220F22C00AF490026B71F /* EditComponent.swift */; }; C2F394082C0462400070B4F6 /* PhotoButtonComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2F394072C0462400070B4F6 /* PhotoButtonComponent.swift */; }; @@ -74,6 +75,7 @@ C24659E82BF60FAA004E80D5 /* ButtonComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonComponent.swift; sourceTree = ""; }; C24DAB5B2C061DC700681CD0 /* AI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AI.swift; sourceTree = ""; }; C24DAB5D2C061E3A00681CD0 /* Language.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Language.swift; sourceTree = ""; }; + C24DAB612C062DBC00681CD0 /* ProfileEdit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileEdit.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 = ""; }; @@ -262,6 +264,7 @@ isa = PBXGroup; children = ( C2F3940A2C0463940070B4F6 /* ProfileComponent.swift */, + C24DAB612C062DBC00681CD0 /* ProfileEdit.swift */, ); path = Visuals; sourceTree = ""; @@ -415,6 +418,7 @@ 82CE59EB2C045E3800ADEE24 /* GameView.swift in Sources */, C20310DA2BFCC8600031657D /* ToggleComponent.swift in Sources */, C25220EE2C00AC7E0026B71F /* GameParametersMenuView.swift in Sources */, + C24DAB622C062DBC00681CD0 /* ProfileEdit.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Image.imageset/Contents.json b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/profil.imageset/Contents.json similarity index 88% rename from ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Image.imageset/Contents.json rename to ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/profil.imageset/Contents.json index a19a549..42378de 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/Image.imageset/Contents.json +++ b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/profil.imageset/Contents.json @@ -1,6 +1,7 @@ { "images" : [ { + "filename" : "Unknown.jpeg", "idiom" : "universal", "scale" : "1x" }, diff --git a/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/profil.imageset/Unknown.jpeg b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/profil.imageset/Unknown.jpeg new file mode 100644 index 0000000..9148723 Binary files /dev/null and b/ArkitDoushiQi/ArkitDoushiQi/Assets.xcassets/images/profil.imageset/Unknown.jpeg differ diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditComponent.swift index 073ca2b..60d522d 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditComponent.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Controls/EditComponent.swift @@ -9,12 +9,15 @@ import SwiftUI struct EditComponent: View { let explanation : String - let value : String - @State private var name = "Joueur 1" + @State private var name : String + init(explanation: String, value: String) { + self.explanation = explanation + self.name = value + } var body: some View { Form { Section(header : Text(explanation)) { - TextField(value, text : $name) + TextField(name, text : $name) } } } @@ -22,6 +25,6 @@ struct EditComponent: View { struct EditComponent_Previews: PreviewProvider { static var previews: some View { - EditComponent(explanation: "Nom du joueur 1", value : "Joueur 1") + EditComponent(explanation: "Nom du Joueur 1", value: "Joueur 1") } } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift index 4f12d75..242d2f8 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileComponent.swift @@ -8,13 +8,41 @@ import SwiftUI struct ProfileComponent: View { + let imageName: String + let color : Color + let profileWidth : CGFloat + let profileHeight : CGFloat var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + GeometryReader { geometry in + ZStack { + // Background color + color + + // Profile Image + Image(imageName) + .resizable() + .scaledToFill() + .clipShape(Circle()) + .frame(width: geometry.size.width * 0.9, height: geometry.size.height * 0.95) // Smaller than the ZStack + } + // Ensure the ZStack takes the size of the GeometryReader + .frame(width: geometry.size.width, height: geometry.size.height) + .clipShape(Circle()) + } + .aspectRatio(1, contentMode: .fit) + .frame(width: profileWidth, height: profileHeight) // Optional fixed size } } struct ProfileComponent_Previews: PreviewProvider { static var previews: some View { - ProfileComponent() + ProfileComponent( + imageName: "profil", + color: Color(.red), + profileWidth: 200, + profileHeight : 200 + ) + .previewLayout(.sizeThatFits) + .padding() } } diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileEdit.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileEdit.swift new file mode 100644 index 0000000..35987fe --- /dev/null +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/Components/Visuals/ProfileEdit.swift @@ -0,0 +1,27 @@ +// +// ProfileEdit.swift +// ArkitDoushiQi +// +// Created by Johan LACHENAL on 28/05/2024. +// + +import SwiftUI + +struct ProfileEdit: View { + var body: some View { + Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + } +} + +struct ProfileEdit_Previews: PreviewProvider { + static var previews: some View { + VStack { + ProfileComponent(imageName: "profil", color: Color(.red), profileWidth: 100, profileHeight: 100) + VStack(alignment: .trailing) { + HStack { + EditComponent(explanation: "Nom du Joueur 1", value: "Joueur 1") + } + } + } + } +} diff --git a/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift b/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift index 79893b5..0c04497 100644 --- a/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift +++ b/ArkitDoushiQi/ArkitDoushiQi/Views/GameParametersMenu/GameParametersMenuView.swift @@ -37,8 +37,20 @@ struct GameParametersMenuView: View { 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") + ProfileComponent( + imageName: "profil", + color: Color(.red), + profileWidth: 100, + profileHeight : 100 + ) + EditComponent(explanation: "Nom du joueur 1", value: "Joueur 1").frame(width: .infinity,height: 100) + ProfileComponent( + imageName: "profil", + color: Color(.red), + profileWidth: 100, + profileHeight : 100 + ) + EditComponent(explanation: "Nom du joueur 2",value: "Joueur 2").frame(width: .infinity,height: 100) ButtonComponent(title: "Lancer la partie") { GameView() }.padding(EdgeInsets(top: 10, leading: 32, bottom: 10, trailing: 32))