add menu button composant 🚧; main menu page is over :sparkles; add assets 🍱 #4

Merged
rayhan.hassou merged 1 commits from dev_views_MainPage into dev_views 11 months ago

@ -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 = "<group>"; };
649B59B12BF65392002BAE38 /* TextStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextStyles.swift; sourceTree = "<group>"; };
649B59B32BF653E1002BAE38 /* ViewTitleTextStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewTitleTextStyle.swift; sourceTree = "<group>"; };
EC62C4EE2BFE367F0048CD0B /* SwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -128,6 +130,7 @@
isa = PBXGroup;
children = (
643AB69A2BFCFB5C0018DA73 /* HistoricView.swift */,
EC62C4EE2BFE367F0048CD0B /* SwiftUIView.swift */,
);
path = Game;
sourceTree = "<group>";
@ -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 */,

@ -10,4 +10,5 @@ import SwiftUI
public struct Colors {
static let TitleText = Color("TitleTextColor")
static let Button = Color("ButtonColor")
}

@ -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
}
}

@ -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
}
}

@ -10,4 +10,5 @@ import SwiftUI
public struct AppImages {
static let TitleImage = "TitlePageImage"
static let SemiLion = "SemiLion"
}

@ -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
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

@ -0,0 +1,25 @@
<svg width="189" height="498" viewBox="0 0 189 498" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1_3268)" filter="url(#filter0_f_1_3268)">
<path d="M382.621 215.799C382.621 280.998 367.172 328.099 326.932 366.096C286.691 404.095 221.662 432.991 206.134 448.623C188.76 432.992 121.271 404.095 81.4915 366.096C41.7124 328.099 29.646 280.998 29.646 215.799C29.646 85.4001 108.663 31 206.134 31C303.606 31 382.621 85.4001 382.621 215.799Z" fill="white" stroke="#0D0501" stroke-width="6.9846"/>
<path d="M103.782 60.4177C139.069 83.6755 178.165 144.19 206.065 234.072C153.55 188.305 69.4868 158.676 32.7195 189.01" stroke="#0D0501" stroke-width="7.7606"/>
<path d="M40.1171 294.518C69.8771 236.433 211.364 234.035 203.605 231.872C196.221 229.813 97.3095 309.398 87.7663 373.653" stroke="#0D0501" stroke-width="7.7606"/>
<path d="M149.375 413.222C149.074 369.401 201.146 228.22 206.061 231.874" stroke="#0D0501" stroke-width="7.7606"/>
<path d="M202.348 89.0595C181.351 89.8512 161.676 98.5256 144.555 112.384C127.637 102.836 93.8681 104.951 81.372 114.084C74.6176 143.49 79.1279 176.397 89.9115 198.815C84.985 215.771 82.2869 233.481 82.2869 251.109C82.2869 308.824 111.136 349.456 152.841 367.528C158.186 379.038 171.186 389.906 180.69 392.058C199.695 396.361 213.127 396.754 232.131 392.058C241.851 389.656 254.857 378.133 260.095 366.712C300.763 348.236 328.767 307.935 328.767 251.11C328.767 234.023 326.19 216.862 321.549 200.38C332.879 177.949 337.813 144.177 330.902 114.084C318.216 104.813 283.604 102.741 266.956 112.792C248.861 97.9991 227.89 89.0596 205.501 89.0596C204.437 89.0596 203.405 89.0194 202.348 89.0595Z" fill="white" stroke="#0D0501" stroke-width="6.9846"/>
<path d="M144.416 253.148C142.863 255.917 141.925 259.35 141.925 263.077C141.925 272.228 147.488 279.669 154.328 279.669C160.562 279.669 165.662 273.475 166.528 265.457L144.416 253.148Z" fill="#0D0501"/>
<path d="M178.748 295.04C182.093 278.305 228.543 276.7 233.318 295.04C237.407 310.748 218.496 331.015 206.033 331.063C194.678 331.104 175.386 311.866 178.748 295.04Z" fill="#0D0501"/>
<path opacity="0.2" d="M95.3709 138.466C103.29 134.933 118.684 138.313 128.439 141.763C115.861 157.535 107.634 170.613 99.8898 191.772C93.2601 175.599 91.6636 153.358 95.3709 138.466Z" fill="black"/>
<path d="M13 290.133L132.126 301.124" stroke="#050200" stroke-width="1.5521" stroke-linecap="round"/>
<path d="M139.113 315.425L47.5098 362.686" stroke="#050200" stroke-width="1.5521" stroke-linecap="round"/>
<path d="M147.728 330.819C144.442 334.116 86.111 397.862 86.111 397.862" stroke="#050200" stroke-width="1.5521" stroke-linecap="round"/>
</g>
<defs>
<filter id="filter0_f_1_3268" x="-1" y="-1" width="190" height="500" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
<feGaussianBlur stdDeviation="0.5" result="effect1_foregroundBlur_1_3268"/>
</filter>
<clipPath id="clip0_1_3268">
<rect width="188" height="498" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

@ -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")
}
}

@ -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()
}
}

@ -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()
}
}
}

Loading…
Cancel
Save