diff --git a/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj b/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj index 89a80b7..864b865 100644 --- a/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj +++ b/DouShouQi_App/DouShouQi_App.xcodeproj/project.pbxproj @@ -29,6 +29,7 @@ 649B59AE2BF64EAB002BAE38 /* AppImages.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59AD2BF64EAB002BAE38 /* AppImages.swift */; }; 649B59B22BF65392002BAE38 /* TextStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59B12BF65392002BAE38 /* TextStyles.swift */; }; 649B59B42BF653E1002BAE38 /* ViewTitleTextStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649B59B32BF653E1002BAE38 /* ViewTitleTextStyle.swift */; }; + EC62C4EF2BFE367F0048CD0B /* SwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = EC62C4EE2BFE367F0048CD0B /* SwiftUIView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -88,6 +89,7 @@ 649B59AD2BF64EAB002BAE38 /* AppImages.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppImages.swift; sourceTree = ""; }; 649B59B12BF65392002BAE38 /* TextStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextStyles.swift; sourceTree = ""; }; 649B59B32BF653E1002BAE38 /* ViewTitleTextStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewTitleTextStyle.swift; sourceTree = ""; }; + EC62C4EE2BFE367F0048CD0B /* SwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIView.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -128,6 +130,7 @@ isa = PBXGroup; children = ( 643AB69A2BFCFB5C0018DA73 /* HistoricView.swift */, + EC62C4EE2BFE367F0048CD0B /* SwiftUIView.swift */, ); path = Game; sourceTree = ""; @@ -416,6 +419,7 @@ 649B59AE2BF64EAB002BAE38 /* AppImages.swift in Sources */, 649ABF602BF60F2D002E8894 /* MainMenuButton.swift in Sources */, 643AB6932BFCEFD00018DA73 /* GameResumeFrame.swift in Sources */, + EC62C4EF2BFE367F0048CD0B /* SwiftUIView.swift in Sources */, 649B59B22BF65392002BAE38 /* TextStyles.swift in Sources */, 6458345C2BF5F92300E18321 /* DouShouQi_AppApp.swift in Sources */, 645B4C202BFCCA0500FD658A /* PlayerResumeFrame.swift in Sources */, diff --git a/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift index 14b3ea0..5bcf4a8 100644 --- a/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift +++ b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.swift @@ -10,4 +10,5 @@ import SwiftUI public struct Colors { static let TitleText = Color("TitleTextColor") + static let Button = Color("ButtonColor") } diff --git a/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.xcassets/ButtonColor.colorset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.xcassets/ButtonColor.colorset/Contents.json new file mode 100644 index 0000000..27c0a4f --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.xcassets/ButtonColor.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "universal", + "reference" : "systemRedColor" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "tvos", + "reference" : "systemRedColor" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.xcassets/Color.colorset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.xcassets/Color.colorset/Contents.json new file mode 100644 index 0000000..22c4bb0 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Colors/Colors.xcassets/Color.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "1.000", + "red" : "1.000" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift b/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift index ac0dc80..f26776f 100644 --- a/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/AppImages.swift @@ -10,4 +10,5 @@ import SwiftUI public struct AppImages { static let TitleImage = "TitlePageImage" + static let SemiLion = "SemiLion" } diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/SemiLion.imageset/Contents.json b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/SemiLion.imageset/Contents.json new file mode 100644 index 0000000..29853d4 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/SemiLion.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "doushouqi-lion 1.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/SemiLion.imageset/doushouqi-lion 1.png b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/SemiLion.imageset/doushouqi-lion 1.png new file mode 100644 index 0000000..f306b56 Binary files /dev/null and b/DouShouQi_App/DouShouQi_App/Assets/Images/Images.xcassets/SemiLion.imageset/doushouqi-lion 1.png differ diff --git a/DouShouQi_App/DouShouQi_App/Assets/Images/Semi-lion.svg b/DouShouQi_App/DouShouQi_App/Assets/Images/Semi-lion.svg new file mode 100644 index 0000000..a1a7aa2 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Assets/Images/Semi-lion.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift b/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift index 289207f..e8609f2 100644 --- a/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift +++ b/DouShouQi_App/DouShouQi_App/Components/MainMenuButton.swift @@ -8,13 +8,83 @@ import SwiftUI struct MainMenuButton: View { + + // Text Params + var text: String + @State private var isHovered: Bool = false + var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + Button(action: { + // Action du bouton + }, label: { + Text(text.uppercased()) + .font(.headline) + .fontWeight(.semibold) + .foregroundColor(.white) + .padding() + .frame(maxWidth: .infinity, maxHeight: 40) + .background( + Colors.Button + .clipShape(RoundedRectangle(cornerSize: CGSize(width: 0, height: 0))) + .mask(RoundedCornersShape(cornerRadii: (topLeft: 0, topRight: 10, bottomLeft: 0, bottomRight: 10))) + ) + }) + .frame(width: UIScreen.main.bounds.width / 1.7) + .frame(maxWidth: .infinity, alignment: .leading) + .scaleEffect(isHovered ? 1.1 : 1.0) + .animation(.easeInOut(duration: 0.2), value: isHovered) + .onHover { hovering in + self.isHovered = hovering + } + } +} + +struct RoundedCornersShape: Shape { + var cornerRadii: (topLeft: CGFloat, topRight: CGFloat, bottomLeft: CGFloat, bottomRight: CGFloat) + + func path(in rect: CGRect) -> Path { + let path = UIBezierPath() + + // Top left corner + path.move(to: CGPoint(x: rect.minX, y: rect.minY + cornerRadii.topLeft)) + path.addArc(withCenter: CGPoint(x: rect.minX + cornerRadii.topLeft, y: rect.minY + cornerRadii.topLeft), + radius: cornerRadii.topLeft, + startAngle: .pi, + endAngle: -.pi / 2, + clockwise: true) + + // Top right corner + path.addLine(to: CGPoint(x: rect.maxX - cornerRadii.topRight, y: rect.minY)) + path.addArc(withCenter: CGPoint(x: rect.maxX - cornerRadii.topRight, y: rect.minY + cornerRadii.topRight), + radius: cornerRadii.topRight, + startAngle: -.pi / 2, + endAngle: 0, + clockwise: true) + + // Bottom right corner + path.addLine(to: CGPoint(x: rect.maxX, y: rect.maxY - cornerRadii.bottomRight)) + path.addArc(withCenter: CGPoint(x: rect.maxX - cornerRadii.bottomRight, y: rect.maxY - cornerRadii.bottomRight), + radius: cornerRadii.bottomRight, + startAngle: 0, + endAngle: .pi / 2, + clockwise: true) + + // Bottom left corner + path.addLine(to: CGPoint(x: rect.minX + cornerRadii.bottomLeft, y: rect.maxY)) + path.addArc(withCenter: CGPoint(x: rect.minX + cornerRadii.bottomLeft, y: rect.maxY - cornerRadii.bottomLeft), + radius: cornerRadii.bottomLeft, + startAngle: .pi / 2, + endAngle: .pi, + clockwise: true) + + path.addLine(to: CGPoint(x: rect.minX, y: rect.minY + cornerRadii.topLeft)) + + return Path(path.cgPath) } } struct MainMenuButton_Previews: PreviewProvider { static var previews: some View { - MainMenuButton() + MainMenuButton(text: "test") } } diff --git a/DouShouQi_App/DouShouQi_App/Views/Game/SwiftUIView.swift b/DouShouQi_App/DouShouQi_App/Views/Game/SwiftUIView.swift new file mode 100644 index 0000000..e544d48 --- /dev/null +++ b/DouShouQi_App/DouShouQi_App/Views/Game/SwiftUIView.swift @@ -0,0 +1,98 @@ +// +// SwiftUIView.swift +// DouShouQi_App +// +// Created by étudiant on 22/05/2024. +// + +import SwiftUI + +struct SwiftUIView: View { + var body: some View { + VStack { + TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200) + Spacer() + + VStack { + HStack{ + VStack { + Button(action: { + // Action du bouton + }, label: { + Text("Play".uppercased()) + .font(.headline) + .fontWeight(.semibold) + .foregroundColor(.white) + .frame(maxWidth: .infinity, maxHeight: 50) + .background( + Color.red + ) + .cornerRadius(0) + }) + .frame(width: UIScreen.main.bounds.width / 1.7) + .frame(maxWidth: .infinity, alignment: .leading) + + Button(action: { + // Action du bouton + }, label: { + Text("Historique".uppercased()) + .font(.headline) + .fontWeight(.semibold) + .foregroundColor(.white) + .frame(maxWidth: .infinity, maxHeight: 50) + .background( + Color.red + ) + .cornerRadius(0) + }) + .frame(width: UIScreen.main.bounds.width / 1.7) + .frame(maxWidth: .infinity, alignment: .leading) + + Button(action: { + // Action du bouton + }, label: { + Text("Best scores".uppercased()) + .font(.headline) + .fontWeight(.semibold) + .foregroundColor(.white) + .frame(maxWidth: .infinity, maxHeight: 50) + .background( + Color.red + ) + .cornerRadius(0) + }) + .frame(width: UIScreen.main.bounds.width / 1.7) + .frame(maxWidth: .infinity, alignment: .leading) + + Button(action: { + // Action du bouton + }, label: { + Text("Players".uppercased()) + .font(.headline) + .fontWeight(.semibold) + .foregroundColor(.white) + .frame(maxWidth: .infinity, maxHeight: 50) + .background( + Color.red + ) + .cornerRadius(0) + }) + .frame(width: UIScreen.main.bounds.width / 1.7) + .frame(maxWidth: .infinity, alignment: .leading) + } + .padding() + } + } + .padding(.horizontal, 10) + + Spacer() + } + } +} + + +struct SwiftUIView_Previews: PreviewProvider { + static var previews: some View { + SwiftUIView() + } +} diff --git a/DouShouQi_App/DouShouQi_App/Views/MainMenuView.swift b/DouShouQi_App/DouShouQi_App/Views/MainMenuView.swift index b1f1ac4..408d411 100644 --- a/DouShouQi_App/DouShouQi_App/Views/MainMenuView.swift +++ b/DouShouQi_App/DouShouQi_App/Views/MainMenuView.swift @@ -9,7 +9,47 @@ import SwiftUI struct MainMenuView: View { var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) + VStack { + TitlePageFrame(Text: "DOU SHOU QI", ImageWidth: 200, ImageHeight: 200) + Spacer() + + VStack { + HStack{ + VStack(spacing: 25) { + MainMenuButton(text: "Play") + MainMenuButton(text: "Historique") + MainMenuButton(text: "Best Scores") + MainMenuButton(text: "Players") + } + Image(AppImages.SemiLion) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 200, height: 500) + } + + } + Spacer() + HStack { + Text("Copyright @") + .font(.headline) + .frame(alignment: .trailing) + + Text("Dou Shou Qi Team") + + Spacer() + + Text("2024") + .frame(alignment: .trailing) + } + .padding() // Ajout de padding pour éviter que le contenu ne touche la bordure + .background(Color.white) // Couleur de fond pour le HStack + .overlay( + Rectangle() + .stroke(Color.black, lineWidth: 1) // Couleur et épaisseur de la bordure + ) + + Spacer() + } } }