Compare commits

..

No commits in common. 'master' and 'SpriteKit' have entirely different histories.

@ -7,9 +7,6 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
7B236FB62C29B371008E9CA7 /* DSQ.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B6426F12C00B61500575E16 /* DSQ.xcframework */; };
7B2597B82C203AFE0095F010 /* PlayerSelect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2597B72C203AFE0095F010 /* PlayerSelect.swift */; };
7B2597BA2C203FCB0095F010 /* ImagePicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B2597B92C203FCB0095F010 /* ImagePicker.swift */; };
7B3B17642BF24B32002BC817 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3B17632BF24B32002BC817 /* Player.swift */; }; 7B3B17642BF24B32002BC817 /* Player.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3B17632BF24B32002BC817 /* Player.swift */; };
7B3B17672BF24ED6002BC817 /* FullButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3B17662BF24ED6002BC817 /* FullButtonStyle.swift */; }; 7B3B17672BF24ED6002BC817 /* FullButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B3B17662BF24ED6002BC817 /* FullButtonStyle.swift */; };
7B4508CD2BF206AF0027E1EF /* DouShouQiIOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508CC2BF206AF0027E1EF /* DouShouQiIOSApp.swift */; }; 7B4508CD2BF206AF0027E1EF /* DouShouQiIOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508CC2BF206AF0027E1EF /* DouShouQiIOSApp.swift */; };
@ -21,6 +18,7 @@
7B4508EA2BF206B10027E1EF /* DouShouQiIOSUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508E92BF206B10027E1EF /* DouShouQiIOSUITestsLaunchTests.swift */; }; 7B4508EA2BF206B10027E1EF /* DouShouQiIOSUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508E92BF206B10027E1EF /* DouShouQiIOSUITestsLaunchTests.swift */; };
7B4508F72BF2084B0027E1EF /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508F62BF2084B0027E1EF /* PlayerView.swift */; }; 7B4508F72BF2084B0027E1EF /* PlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508F62BF2084B0027E1EF /* PlayerView.swift */; };
7B4508FA2BF214F50027E1EF /* PlayerListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508F92BF214F50027E1EF /* PlayerListView.swift */; }; 7B4508FA2BF214F50027E1EF /* PlayerListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4508F92BF214F50027E1EF /* PlayerListView.swift */; };
7B6426F22C00B61500575E16 /* DSQ.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B6426F12C00B61500575E16 /* DSQ.xcframework */; };
7B6426F72C00B81400575E16 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6426F62C00B81400575E16 /* GameScene.swift */; }; 7B6426F72C00B81400575E16 /* GameScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6426F62C00B81400575E16 /* GameScene.swift */; };
7B6426F92C00BDEA00575E16 /* SpriteKitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6426F82C00BDEA00575E16 /* SpriteKitView.swift */; }; 7B6426F92C00BDEA00575E16 /* SpriteKitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6426F82C00BDEA00575E16 /* SpriteKitView.swift */; };
7B6426FB2C00BFF500575E16 /* SpriteMeeple.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6426FA2C00BFF500575E16 /* SpriteMeeple.swift */; }; 7B6426FB2C00BFF500575E16 /* SpriteMeeple.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6426FA2C00BFF500575E16 /* SpriteMeeple.swift */; };
@ -32,7 +30,6 @@
7BDE976F2C0E18160079F2CD /* PlayerVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BDE976E2C0E18160079F2CD /* PlayerVM.swift */; }; 7BDE976F2C0E18160079F2CD /* PlayerVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BDE976E2C0E18160079F2CD /* PlayerVM.swift */; };
7BE8C5652C09A29A00A6E8C9 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BE8C5642C09A29A00A6E8C9 /* Color.swift */; }; 7BE8C5652C09A29A00A6E8C9 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BE8C5642C09A29A00A6E8C9 /* Color.swift */; };
7BEAB78B2C19A26000DF39C9 /* StubbedPlayers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BEAB78A2C19A26000DF39C9 /* StubbedPlayers.swift */; }; 7BEAB78B2C19A26000DF39C9 /* StubbedPlayers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BEAB78A2C19A26000DF39C9 /* StubbedPlayers.swift */; };
7BEAB78D2C19A94100DF39C9 /* GameVM.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BEAB78C2C19A94100DF39C9 /* GameVM.swift */; };
BA5AFD332C09C7470056D332 /* ClassicTextDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5AFD322C09C7470056D332 /* ClassicTextDisplay.swift */; }; BA5AFD332C09C7470056D332 /* ClassicTextDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5AFD322C09C7470056D332 /* ClassicTextDisplay.swift */; };
BA5AFD352C09CAC10056D332 /* NavButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5AFD342C09CAC10056D332 /* NavButton.swift */; }; BA5AFD352C09CAC10056D332 /* NavButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5AFD342C09CAC10056D332 /* NavButton.swift */; };
BA5AFD392C09D1020056D332 /* DoubleTextDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5AFD382C09D1020056D332 /* DoubleTextDisplay.swift */; }; BA5AFD392C09D1020056D332 /* DoubleTextDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA5AFD382C09D1020056D332 /* DoubleTextDisplay.swift */; };
@ -56,8 +53,6 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
7B2597B72C203AFE0095F010 /* PlayerSelect.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerSelect.swift; sourceTree = "<group>"; };
7B2597B92C203FCB0095F010 /* ImagePicker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImagePicker.swift; sourceTree = "<group>"; };
7B3B17632BF24B32002BC817 /* Player.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = "<group>"; }; 7B3B17632BF24B32002BC817 /* Player.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Player.swift; sourceTree = "<group>"; };
7B3B17662BF24ED6002BC817 /* FullButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullButtonStyle.swift; sourceTree = "<group>"; }; 7B3B17662BF24ED6002BC817 /* FullButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FullButtonStyle.swift; sourceTree = "<group>"; };
7B4508C92BF206AF0027E1EF /* DouShouQiIOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DouShouQiIOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7B4508C92BF206AF0027E1EF /* DouShouQiIOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DouShouQiIOS.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -85,7 +80,6 @@
7BDE976E2C0E18160079F2CD /* PlayerVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerVM.swift; sourceTree = "<group>"; }; 7BDE976E2C0E18160079F2CD /* PlayerVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerVM.swift; sourceTree = "<group>"; };
7BE8C5642C09A29A00A6E8C9 /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; }; 7BE8C5642C09A29A00A6E8C9 /* Color.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = "<group>"; };
7BEAB78A2C19A26000DF39C9 /* StubbedPlayers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubbedPlayers.swift; sourceTree = "<group>"; }; 7BEAB78A2C19A26000DF39C9 /* StubbedPlayers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StubbedPlayers.swift; sourceTree = "<group>"; };
7BEAB78C2C19A94100DF39C9 /* GameVM.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameVM.swift; sourceTree = "<group>"; };
BA5AFD322C09C7470056D332 /* ClassicTextDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassicTextDisplay.swift; sourceTree = "<group>"; }; BA5AFD322C09C7470056D332 /* ClassicTextDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassicTextDisplay.swift; sourceTree = "<group>"; };
BA5AFD342C09CAC10056D332 /* NavButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavButton.swift; sourceTree = "<group>"; }; BA5AFD342C09CAC10056D332 /* NavButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NavButton.swift; sourceTree = "<group>"; };
BA5AFD382C09D1020056D332 /* DoubleTextDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleTextDisplay.swift; sourceTree = "<group>"; }; BA5AFD382C09D1020056D332 /* DoubleTextDisplay.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DoubleTextDisplay.swift; sourceTree = "<group>"; };
@ -96,7 +90,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
7B236FB62C29B371008E9CA7 /* DSQ.xcframework in Frameworks */, 7B6426F22C00B61500575E16 /* DSQ.xcframework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -124,8 +118,6 @@
7B6426F62C00B81400575E16 /* GameScene.swift */, 7B6426F62C00B81400575E16 /* GameScene.swift */,
7B6426FA2C00BFF500575E16 /* SpriteMeeple.swift */, 7B6426FA2C00BFF500575E16 /* SpriteMeeple.swift */,
7BDE976E2C0E18160079F2CD /* PlayerVM.swift */, 7BDE976E2C0E18160079F2CD /* PlayerVM.swift */,
7BEAB78C2C19A94100DF39C9 /* GameVM.swift */,
7B2597B92C203FCB0095F010 /* ImagePicker.swift */,
); );
path = Class; path = Class;
sourceTree = "<group>"; sourceTree = "<group>";
@ -211,7 +203,6 @@
7BB279882BFDF79E00491801 /* GameView.swift */, 7BB279882BFDF79E00491801 /* GameView.swift */,
7B6426F82C00BDEA00575E16 /* SpriteKitView.swift */, 7B6426F82C00BDEA00575E16 /* SpriteKitView.swift */,
7BDE976C2C0E13160079F2CD /* EditModalView.swift */, 7BDE976C2C0E13160079F2CD /* EditModalView.swift */,
7B2597B72C203AFE0095F010 /* PlayerSelect.swift */,
); );
path = View; path = View;
sourceTree = "<group>"; sourceTree = "<group>";
@ -388,14 +379,12 @@
7BDD43C72BFCC927003984FB /* MainMenuView.swift in Sources */, 7BDD43C72BFCC927003984FB /* MainMenuView.swift in Sources */,
7B4508CF2BF206AF0027E1EF /* ContentView.swift in Sources */, 7B4508CF2BF206AF0027E1EF /* ContentView.swift in Sources */,
7BE8C5652C09A29A00A6E8C9 /* Color.swift in Sources */, 7BE8C5652C09A29A00A6E8C9 /* Color.swift in Sources */,
7B2597B82C203AFE0095F010 /* PlayerSelect.swift in Sources */,
7B6426FB2C00BFF500575E16 /* SpriteMeeple.swift in Sources */, 7B6426FB2C00BFF500575E16 /* SpriteMeeple.swift in Sources */,
7B4508CD2BF206AF0027E1EF /* DouShouQiIOSApp.swift in Sources */, 7B4508CD2BF206AF0027E1EF /* DouShouQiIOSApp.swift in Sources */,
7BEAB78B2C19A26000DF39C9 /* StubbedPlayers.swift in Sources */, 7BEAB78B2C19A26000DF39C9 /* StubbedPlayers.swift in Sources */,
7B6426F92C00BDEA00575E16 /* SpriteKitView.swift in Sources */, 7B6426F92C00BDEA00575E16 /* SpriteKitView.swift in Sources */,
7BDE976D2C0E13160079F2CD /* EditModalView.swift in Sources */, 7BDE976D2C0E13160079F2CD /* EditModalView.swift in Sources */,
7BDE976F2C0E18160079F2CD /* PlayerVM.swift in Sources */, 7BDE976F2C0E18160079F2CD /* PlayerVM.swift in Sources */,
7B2597BA2C203FCB0095F010 /* ImagePicker.swift in Sources */,
BA5AFD392C09D1020056D332 /* DoubleTextDisplay.swift in Sources */, BA5AFD392C09D1020056D332 /* DoubleTextDisplay.swift in Sources */,
BA5AFD332C09C7470056D332 /* ClassicTextDisplay.swift in Sources */, BA5AFD332C09C7470056D332 /* ClassicTextDisplay.swift in Sources */,
BA5AFD352C09CAC10056D332 /* NavButton.swift in Sources */, BA5AFD352C09CAC10056D332 /* NavButton.swift in Sources */,
@ -403,7 +392,6 @@
7BDD43C92BFCD2C4003984FB /* HistoryView.swift in Sources */, 7BDD43C92BFCD2C4003984FB /* HistoryView.swift in Sources */,
7B3B17642BF24B32002BC817 /* Player.swift in Sources */, 7B3B17642BF24B32002BC817 /* Player.swift in Sources */,
7B3B17672BF24ED6002BC817 /* FullButtonStyle.swift in Sources */, 7B3B17672BF24ED6002BC817 /* FullButtonStyle.swift in Sources */,
7BEAB78D2C19A94100DF39C9 /* GameVM.swift in Sources */,
7B4508FA2BF214F50027E1EF /* PlayerListView.swift in Sources */, 7B4508FA2BF214F50027E1EF /* PlayerListView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;

@ -10,68 +10,92 @@ import DouShouQiModel
import SpriteKit import SpriteKit
import SwiftUI import SwiftUI
// Class GameScene
// This class is used to display the game board and the pieces on it
class GameScene : SKScene{ class GameScene : SKScene{
let imgBoard : SKSpriteNode = SKSpriteNode(imageNamed: "BoardImg") let imgBoard : SKSpriteNode = SKSpriteNode(imageNamed: "BoardImg")
let defaultSize : CGSize = CGSize(width: 120, height: 120) let defaultSize : CGSize = CGSize(width: 120, height: 120)
var game : Game = try! Game(withRules: ClassicRules(),
andPlayer1: Player(withName: "Meruemu", andId: .player1)!,
andPlayer2: Player(withName: "Kumogi", andId: .player2)!)
// Define constants let pieces : [ Owner : [Animal : SpriteMeeple]] =
let meepleSizeWidth: CGFloat = 120 [ .player1 : [
let meepleSizeHeight: CGFloat = 120 .rat : SpriteMeeple(imageName: "RatMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
.cat : SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
// Players pieces .dog : SpriteMeeple(imageName: "DogoMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
let pieces: [Owner: [Animal: SpriteMeeple]] = .wolf : SpriteMeeple(imageName: "WolfMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
[ .leopard : SpriteMeeple(imageName: "LeoMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
.player1: [ .tiger : SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
.rat: SpriteMeeple(imageName: "RatMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1), .lion : SpriteMeeple(imageName: "LionMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
.cat: SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1), .elephant : SpriteMeeple(imageName: "ElphMeeple", size: CGSize(width: 120, height: 120), color: Color.player1),
.dog: SpriteMeeple(imageName: "DogoMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1), ],
.wolf: SpriteMeeple(imageName: "WolfMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1),
.leopard: SpriteMeeple(imageName: "LeoMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1), .player2: [
.tiger: SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1), .rat : SpriteMeeple(imageName: "RatMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
.lion: SpriteMeeple(imageName: "LionMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1), .cat : SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
.elephant: SpriteMeeple(imageName: "ElphMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player1), .dog : SpriteMeeple(imageName: "DogoMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
], .wolf : SpriteMeeple(imageName: "WolfMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
.leopard : SpriteMeeple(imageName: "LeoMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
.player2: [ .tiger : SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
.rat: SpriteMeeple(imageName: "RatMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2), .lion : SpriteMeeple(imageName: "LionMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
.cat: SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2), .elephant : SpriteMeeple(imageName: "ElphMeeple", size: CGSize(width: 120, height: 120), color: Color.player2),
.dog: SpriteMeeple(imageName: "DogoMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2),
.wolf: SpriteMeeple(imageName: "WolfMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2),
.leopard: SpriteMeeple(imageName: "LeoMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2),
.tiger: SpriteMeeple(imageName: "CatMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2),
.lion: SpriteMeeple(imageName: "LionMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2),
.elephant: SpriteMeeple(imageName: "ElphMeeple", size: CGSize(width: meepleSizeWidth, height: meepleSizeHeight), color: Color.player2),
]
] ]
]
override init(size s: CGSize){ override init(size s: CGSize){
super.init(size: s) super.init(size: s)
self.addChild(imgBoard) self.addChild(imgBoard)
self.displayBoard(game.board)
/*
let cat = SpriteMeeple(imageName: "CatMeeple")
cat.position = CGPoint(x: 300, y: 200)
cat.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(cat)
let rat = SpriteMeeple(imageName: "RatMeeple")
rat.position = CGPoint(x: 200, y: 100)
rat.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(rat)
let dog = SpriteMeeple(imageName: "DogoMeeple")
dog.position = CGPoint(x: 200, y: 300)
dog.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(dog)
let cat2 = SpriteMeeple(imageName: "CatMeeple")
cat2.position = CGPoint(x: 300, y: -200)
cat2.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(cat2)
let rat2 = SpriteMeeple(imageName: "RatMeeple")
rat2.position = CGPoint(x: 200, y: -100)
rat2.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(rat2)
let dog2 = SpriteMeeple(imageName: "DogoMeeple")
dog2.position = CGPoint(x: 200, y: -300)
dog2.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(dog2)
let wolf = SpriteMeeple(imageName: "WolfMeeple")
wolf.position = CGPoint(x: 300, y: 0)
wolf.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(wolf)
*/
self.scaleMode = .aspectFit self.scaleMode = .aspectFit
self.anchorPoint = CGPoint(x: 0.5, y:0.5) self.anchorPoint = CGPoint(x: 0.5, y:0.5)
} }
/** private func displayBoard(_ board : DouShouQiModel.Board){
* Display the board
* @param board : DouShouQiModel.Board - The board to display
*/
func displayBoard(_ board : DouShouQiModel.Board){
//Nettoyage des fils
self.removeAllChildren()
self.addChild(imgBoard)
for row in 0..<board.nbRows{ for row in 0..<board.nbRows{
for col in 0..<board.nbColumns{ for col in 0..<board.nbColumns{
if let p = board.grid[row][col].piece{ if let p = board.grid[row][col].piece{
pieces[p.owner]?[p.animal]?.cellPosition = CGPoint(x: row, y: col); pieces[p.owner]?[p.animal]?.cellPosition = CGPoint(x: row, y: col);
pieces[p.owner]?[p.animal]?.imageNode.size = CGSize(width: meepleSizeWidth, height: meepleSizeHeight) pieces[p.owner]?[p.animal]?.imageNode.size = CGSize(width: 120, height: 120)
self.addChild(pieces[p.owner]![p.animal]!) self.addChild(pieces[p.owner]![p.animal]!);
} }
} }
} }

@ -1,153 +0,0 @@
//
// GameVM.swift
// DouShouQiIOS
//
// Created by Pierre FERREIRA on 12/06/2024.
//
import Foundation
import DouShouQiModel
import SpriteKit
import SwiftUI
/**
* GameVM
* Cette classe est utilisée pour gérer la logique du jeu
*/
class GameVM : ObservableObject, Identifiable {
@Published var game: Game
@Published var gameScene: GameScene
@Published var isGameOver: Bool = false
///Error
@Published var hasError : Bool = false
///Message
@Published var displayMessage : String = ""
public init(withGame _game : Game, andScene _gameScene : GameScene) {
self.game = _game
self.gameScene = _gameScene
///Abonnement aux événements
self.game.addGameStartedListener(onGameStart)
self.game.addPlayerNotifiedListener(onPlayerNotified)
self.game.addMoveChosenCallbacksListener(onMoveChosen)
self.game.addInvalidMoveCallbacksListener(onInvalidMove)
self.game.addBoardChangedListener(onBoardChanged)
self.game.addGameOverListener(onGameOver)
//self.game?.addGameChangedListener({}) - //? cas persistance
self.subscribesToMeeple()
///Lancement du jeu
Task{
try! await self.game.start()
}
}
/// Début du jeu
func onGameStart(board : Board){
displayMessage = "==>> 🎉 GAME STARTS! 🎉 <<=="
self.gameScene.displayBoard(board)
}
/// Notification du joueur
func onPlayerNotified(board : Board, player : Player) async{
if player is HumanPlayer {
displayMessage = "Player \(player.id == .player1 ? "🟡 1" : "🔴 2") - \(player.name), it's your turn!"
}
else {
do{
_ = try await player.chooseMove(in: board, with: self.game.rules)
}
catch{
hasError = true
}
}
}
/// Mouvement choisi
func onMoveChosen(board : Board, move : Move, player : Player){
///Récupération du Meeple :
let movedPiece = board.grid[move.rowOrigin][move.columnOrigin]
let meeples = gameScene.pieces[move.owner]
let meeple = meeples?.first(where: {
$0.key == movedPiece.piece?.animal
})
meeple?.value.cellPosition = CGPoint(x: move.rowDestination, y: move.columnDestination)
}
///Mouvement invalide
func onInvalidMove(board : Board, move : Move, player : Player, result : Bool){
displayMessage = "⚠️⚠️⚠️⚠️ Invalid Move detected: \(move) by \(player.name) (\(player.id))"
if result { ///* invalidité terminante
if let piece = board.grid[move.rowDestination][move.columnDestination].piece{
let meeples = gameScene.pieces[player.id == .player1 ? .player2 : .player1]
let meeple = meeples?.first(where: {
$0.key == piece.animal
})
meeple?.value.parent?.removeChildren(in: [meeple!.value])
}
return
}
///* invalidité non terminante
let piece = board.grid[move.rowOrigin][move.columnOrigin]
let meeples = gameScene.pieces[move.owner]
let meeple = meeples?.first(where: {
$0.key == piece.piece?.animal
})
meeple?.value.cellPosition = CGPoint(x: move.rowOrigin, y: move.columnOrigin);
}
///Changement de plateau
func onBoardChanged(board : Board){
/// Bruit d'un placement de pion ?
}
///Fin du jeu
func onGameOver(board : Board, result : Result, winner : Player?){
displayMessage = "Game Over!!!"
isGameOver = true ///Gestion par l'appelant
}
///*Meeples
///Abonnement aux mouvements des Meeples
func subscribesToMeeple(){
for meeple in gameScene.pieces[.player1]!{
meeple.value.observers.append(meepleMoved)
}
for meeple in gameScene.pieces[.player2]!{
meeple.value.observers.append(meepleMoved)
}
}
///*Mouvement d'un Meeple
func meepleMoved(spriteMeeple: SpriteMeeple, startX: Int, startY: Int, endX: Int, endY: Int) async{
let owner : Owner = game.board.grid[startX][startY].piece!.owner
let otherPlayer : Owner = self.game.rules.getNextPlayer()
let move: Move = Move(of: owner, fromRow: startX, andFromColumn: startY, toRow: endX, andToColumn: endY)
if(otherPlayer != owner){ ///Mauvais Joueur pour ce jeton
onInvalidMove(board: game.board, move: move, player: game.players[otherPlayer]!, result: false)
return
}
if let player: HumanPlayer = game.players[owner] as? HumanPlayer{
try! await player.chooseMove(move)
}
// else { ///! IMPOSSIBLE DE CAST LE JOUEUR HUMAIN ==> SIGABRT
// let player: HumanPlayer = game.players[.player1] as! HumanPlayer
// try! await player.chooseMove(move)
// }
}
}

@ -1,53 +0,0 @@
//
// ImagePicker.swift
// DouShouQiIOS
//
// Created by Pierre FERREIRA on 17/06/2024.
//
import SwiftUI
/// ImagePicker
/// Classe récupéré d'internet pour permettre de choisir une image dans la galerie
struct ImagePicker: UIViewControllerRepresentable {
@Environment(\.presentationMode) private var presentationMode
var sourceType: UIImagePickerController.SourceType = .photoLibrary
@Binding var selectedImage: UIImage
func makeUIViewController(context: UIViewControllerRepresentableContext<ImagePicker>) -> UIImagePickerController {
let imagePicker = UIImagePickerController()
imagePicker.allowsEditing = false
imagePicker.sourceType = sourceType
imagePicker.delegate = context.coordinator
return imagePicker
}
func updateUIViewController(_ uiViewController: UIImagePickerController, context: UIViewControllerRepresentableContext<ImagePicker>) {
}
func makeCoordinator() -> Coordinator {
Coordinator(self)
}
final class Coordinator: NSObject, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
var parent: ImagePicker
init(_ parent: ImagePicker) {
self.parent = parent
}
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) {
if let image = info[UIImagePickerController.InfoKey.originalImage] as? UIImage {
parent.selectedImage = image
}
parent.presentationMode.wrappedValue.dismiss()
}
}
}

@ -7,7 +7,6 @@
import Foundation import Foundation
///! Ancienne classe, supprimée suite à la mise en place de la librairie DouShouQiModel
/// Représente un joueur /// Représente un joueur
/* /*

@ -8,8 +8,6 @@
import Foundation import Foundation
import DouShouQiModel import DouShouQiModel
/// PlayerVM
/// Cette classe est utilisée pour gérer la logique du joueur
class PlayerVM : ObservableObject, Identifiable { class PlayerVM : ObservableObject, Identifiable {
@Published var player : Player @Published var player : Player
@Published var data : Player.Data @Published var data : Player.Data
@ -21,13 +19,11 @@ class PlayerVM : ObservableObject, Identifiable {
self.isEditing = false self.isEditing = false
} }
/// Début de l'édition
func onEditing(){ func onEditing(){
self.data = player.data self.data = player.data
self.isEditing = true self.isEditing = true
} }
/// Fin de l'édition
func onEdited(isCanceled cancel : Bool = false){ func onEdited(isCanceled cancel : Bool = false){
if !cancel { if !cancel {
//save //save

@ -9,11 +9,7 @@ import Foundation
import SpriteKit import SpriteKit
import SwiftUI import SwiftUI
/// SpriteMeeple class SpriteMeeple : SKNode{
/// Cette classe est utilisée pour gérer les pièces des joueurs
class SpriteMeeple : SKNode, ObservableObject{
let imageNode : SKSpriteNode let imageNode : SKSpriteNode
let ellipseNode : SKShapeNode let ellipseNode : SKShapeNode
@ -28,11 +24,6 @@ class SpriteMeeple : SKNode, ObservableObject{
static let offset = CGPoint(x:-400, y:-300) static let offset = CGPoint(x:-400, y:-300)
static let direction = CGVector(dx:100, dy:100); static let direction = CGVector(dx:100, dy:100);
//@Published var observers : [ any ObservableObject ] = []
@Published var observers : [ (SpriteMeeple, Int, Int, Int, Int) async ->() ] = []
public init(imageName imgN : String,size meepleSize : CGSize,color meepleColor : Color){ public init(imageName imgN : String,size meepleSize : CGSize,color meepleColor : Color){
imageNode = SKSpriteNode(imageNamed: imgN) imageNode = SKSpriteNode(imageNamed: imgN)
imageNode.size = meepleSize; imageNode.size = meepleSize;
@ -41,6 +32,7 @@ class SpriteMeeple : SKNode, ObservableObject{
ellipseNode = SKShapeNode(ellipseOf: CGSize(width: 100, height: 100)) ellipseNode = SKShapeNode(ellipseOf: CGSize(width: 100, height: 100))
ellipseNode.fillColor = UIColor(meepleColor); ellipseNode.fillColor = UIColor(meepleColor);
self.cellPosition = CGPoint(x: 0, y: 0) self.cellPosition = CGPoint(x: 0, y: 0)
@ -57,63 +49,43 @@ class SpriteMeeple : SKNode, ObservableObject{
get {true} get {true}
} }
///TouchesBegan
/// Cette fonction est appelée lorsque l'utilisateur commence à toucher l'écran
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) { override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
self.position = touches.first?.location(in: parent!) ?? CGPoint(x: 0, y: 0) self.position = touches.first?.location(in: parent!) ?? CGPoint(x: 0, y: 0)
} }
///TouchesEnded
/// Cette fonction est appelée lorsque l'utilisateur a terminé de toucher l'écran
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
//* Contantes
///Limites du board
static let rightLimit: CGFloat = 400
static let leftLimit: CGFloat = -400
static let topLimit: CGFloat = 300
static let bottomLimit: CGFloat = -300
static let gridSize: CGFloat = 100
/// Bordures du board /// Bordures du board
///Right ///Right
if (self.position.x < leftLimit){ if (self.position.x < -400){
self.position.x = leftLimit; self.position.x = -400;
} }
///Left ///Left
if (self.position.x > rightLimit){ if (self.position.x > 400){
self.position.x = rightLimit; self.position.x = 400;
} }
///Bottom ///Bottom
if (self.position.y < bottomLimit){ if (self.position.y < -300){
self.position.y = bottomLimit; self.position.y = -300;
} }
///Top ///Top
if (self.position.y > topLimit){ if (self.position.y > 300){
self.position.y = topLimit; self.position.y = 300;
} }
if (!Int(self.position.x).isMultiple(of: gridSize)){ if (!Int(self.position.x).isMultiple(of: 100)){
let calcx = self.position.x/gridSize; let calcx = self.position.x/100.0;
self.position.x = (calcx.rounded(.toNearestOrAwayFromZero))*gridSize; self.position.x = (calcx.rounded(.toNearestOrAwayFromZero))*100;
} }
if (!Int(self.position.y).isMultiple(of: gridSize)){ if (!Int(self.position.y).isMultiple(of: 100)){
let calcy = self.position.y/gridSize; let calcy = self.position.y/100.0;
self.position.y = (calcy.rounded(.toNearestOrAwayFromZero))*gridSize; self.position.y = (calcy.rounded(.toNearestOrAwayFromZero))*100;
} }
///Envoi aux observers d'une notif
///* Execution des Observeurs
Task {
for observer in observers {
await observer(self, Int(cellPosition.x), Int(cellPosition.y), Int(position.x), Int(position.y))
}
}
} }
required init?(coder aDecoder: NSCoder) { required init?(coder aDecoder: NSCoder) {

@ -7,8 +7,6 @@
import SwiftUI import SwiftUI
/// ClassicTextDisplay
/// Affichage classique d'un texte récurrent
struct ClassicTextDisplay: View { struct ClassicTextDisplay: View {
let text : String let text : String

@ -7,7 +7,6 @@
import SwiftUI import SwiftUI
/// Affichage d'une texte en deux parties
struct DoubleTextDisplay: View { struct DoubleTextDisplay: View {
let textL : String let textL : String
let textR : String let textR : String

@ -7,7 +7,6 @@
import SwiftUI import SwiftUI
/// Bouton de navigation récurrent
struct NavButton<D1:View>: View { struct NavButton<D1:View>: View {
let text : String let text : String

@ -8,8 +8,6 @@
import Foundation import Foundation
import SwiftUI import SwiftUI
/// Extension de la classe Color pour ajouter des couleurs personnalisées
//! classe DEPRECATED : utilisée avant la mise en place des thèmes via XCode
public extension Color { public extension Color {
init(hex: String) { init(hex: String) {
let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted) let hex = hex.trimmingCharacters(in: CharacterSet.alphanumerics.inverted)

@ -8,8 +8,6 @@
import Foundation import Foundation
import DouShouQiModel import DouShouQiModel
/// Extension de Player
//! DEPRECIATED : Créé pour la modification de la classe Player, abandonné car nécéssite l'abandon de la librairie DouShouQiModel
extension Player { extension Player {
//var age : Int{get{return 0} set{age = newValue}} //var age : Int{get{return 0} set{age = newValue}}

@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -8,8 +8,6 @@
import Foundation import Foundation
import SwiftUI import SwiftUI
/// FullButtonStyle
/// Utilisé pour définir le style d'un bouton
struct FullButtonStyle: ButtonStyle { struct FullButtonStyle: ButtonStyle {
func makeBody(configuration: Configuration) -> some View { func makeBody(configuration: Configuration) -> some View {
configuration.label configuration.label

@ -8,10 +8,8 @@
import Foundation import Foundation
import DouShouQiModel import DouShouQiModel
// Liste de joueurs fictifs afin de tester l'application.
struct StubbedPlayers{ struct StubbedPlayers{
//(Joueurs populaires de Gun-gi)//
let meruem : PlayerVM = PlayerVM(with: Player(withName: "Meruemu", andId: .player1)!) let meruem : PlayerVM = PlayerVM(with: Player(withName: "Meruemu", andId: .player1)!)
let kumogi : PlayerVM = PlayerVM(with: Player(withName: "Kumogi", andId: .player2)!) let kumogi : PlayerVM = PlayerVM(with: Player(withName: "Kumogi", andId: .player2)!)

@ -8,8 +8,6 @@
import SwiftUI import SwiftUI
import DouShouQiModel import DouShouQiModel
/// EditModalView
/// Cette vue modale est utilisée pour éditer un joueur
struct EditModalView: View { struct EditModalView: View {
var playerVM : PlayerVM var playerVM : PlayerVM

@ -7,39 +7,32 @@
import SwiftUI import SwiftUI
import SpriteKit import SpriteKit
import DouShouQiModel
/// Vue principale du jeu
struct GameView: View { struct GameView: View {
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
@State private var turnNumber = 1 @State private var turnNumber = 1
@State private var gameTime = 0.0 // Temps en secondes @State private var gameTime = 0.0 // Temps en secondes
@State private var statusMessage = "C'est votre tour"
//Nombre de pièces des joueurs
@State private var player1Pieces = 8 @State private var player1Pieces = 8
@State private var player2Pieces = 8 @State private var player2Pieces = 8
var timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect() var timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
let gridItems = Array(repeating: GridItem(.flexible()), count: 8) let gridItems = Array(repeating: GridItem(.flexible()), count: 8)
///VM ///SK
var gameVM : GameVM var gs : GameScene = GameScene(size: CGSizeMake(940,740))
init (gameVM : GameVM){
self.gameVM = gameVM
}
var body: some View { var body: some View {
ZStack{ ZStack{
Rectangle().fill(Color.bgColor).edgesIgnoringSafeArea(.all) Rectangle().fill(Color.bgColor).edgesIgnoringSafeArea(.all)
VStack { VStack {
VStack { VStack {
Text(gameVM.displayMessage) Text(statusMessage)
.font(.title3) .font(.title)
.padding(.top, 20) .padding(.top, 20)
HStack { HStack {
@ -53,8 +46,26 @@ struct GameView: View {
} }
.padding([.leading, .trailing], 20) .padding([.leading, .trailing], 20)
} }
SpriteView(scene: gameVM.gameScene) /*
///Old Grid Support
LazyVGrid(columns: gridItems, spacing: 5) {
ForEach(0..<64) { index in
Rectangle()
.foregroundColor((index / 8 + index % 8) % 2 == 0 ? .orange : .gray.opacity(0.2))
.frame(height: 35)
.cornerRadius(10)
}
}
.padding(10)
.background(Color.yellow)
.cornerRadius(15)
.padding(20)
*/
SpriteView(scene: gs)
.frame(width: 350, height: 275) .frame(width: 350, height: 275)
.padding(10) .padding(10)
.background(Color.primaryColor) .background(Color.primaryColor)
@ -99,6 +110,6 @@ struct GameView: View {
struct GameView_Previews: PreviewProvider { struct GameView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
GameView(gameVM: GameVM(withGame: try! Game(withRules: ClassicRules(), andPlayer1: Player(withName: "toto", andId: .player1)!, andPlayer2: Player(withName: "tata", andId: .player2)!), andScene: GameScene(size: CGSize(width: 120, height: 120)))) GameView()
} }
} }

@ -7,7 +7,7 @@
import SwiftUI import SwiftUI
/// Vue de l'historique d'un joueur
struct HistoryView: View { struct HistoryView: View {
var playerName: String var playerName: String
var matches: [Match] // Modèle des parties du joueur var matches: [Match] // Modèle des parties du joueur
@ -68,6 +68,7 @@ struct Match: Identifiable {
var opponent: String var opponent: String
var selfScore: Int var selfScore: Int
var opScore: Int var opScore: Int
//var result: String
} }
struct HistoryView_Previews: PreviewProvider { struct HistoryView_Previews: PreviewProvider {

@ -6,18 +6,10 @@
// //
import SwiftUI import SwiftUI
import DouShouQiModel
/// Vue principale de l'application
struct MainMenuView: View { struct MainMenuView: View {
@Environment(\.colorScheme) var colorScheme @Environment(\.colorScheme) var colorScheme
var gamevm : GameVM = GameVM(withGame: try! Game(withRules: ClassicRules(),
andPlayer1: Player(withName: "Meruemu", andId: .player1)!,
andPlayer2: Player(withName: "Kumogi", andId: .player2)!),
andScene: GameScene(size: CGSize(width: 940, height: 740)))
var body: some View { var body: some View {
NavigationStack { NavigationStack {
@ -35,11 +27,10 @@ struct MainMenuView: View {
.bold() .bold()
.padding() .padding()
//NavButton("Jouer Seul", destinationView: {PlayerSelect(versus: false)}) NavButton("Jouer Seul", destinationView: {GameView()})
NavButton("Jouer Seul", destinationView: {GameView(gameVM: gamevm)})
.padding(.top, 10) .padding(.top, 10)
NavButton("Jouer en Multi", destinationView: {PlayerSelect(versus: true)}) NavButton("Jouer en Multi", destinationView: {GameView()})
NavButton("Leaderboard", destinationView: {PlayerListView()}) NavButton("Leaderboard", destinationView: {PlayerListView()})

@ -8,14 +8,16 @@
import SwiftUI import SwiftUI
import DouShouQiModel import DouShouQiModel
/// Liste des joueurs
struct PlayerListView: View { struct PlayerListView: View {
var playerStub : StubbedPlayers = StubbedPlayers() var playerStub : StubbedPlayers = StubbedPlayers()
var body: some View { var body: some View {
//NavigationStack {
ZStack { ZStack {
Rectangle().fill(Color.bgColor).ignoresSafeArea() Rectangle().fill(Color.bgColor).ignoresSafeArea()
VStack { VStack {
/*Text("Classement des joueurs")
.scaleEffect(1.75)*/
List(playerStub.getStubbedPlayer()) { player in List(playerStub.getStubbedPlayer()) { player in
NavigationLink { NavigationLink {
PlayerView(age: 18, winLossRatio: 1.0, gamesPlayed: 10, wins: 5, losses: 5, histoMatches: [ PlayerView(age: 18, winLossRatio: 1.0, gamesPlayed: 10, wins: 5, losses: 5, histoMatches: [
@ -23,7 +25,7 @@ struct PlayerListView: View {
Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3), Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3),
Match(gameEndScreen: "opponent3", opponent: "Opponent 3", selfScore: 2, opScore: 2) Match(gameEndScreen: "opponent3", opponent: "Opponent 3", selfScore: 2, opScore: 2)
], ],
playerVm: player) playerVm: player) //mettre player plus tard
} label:{Text("pif")} } label:{Text("pif")}
}.navigationDestination(for: String.self) { name in }.navigationDestination(for: String.self) { name in
PlayerView(age: 18, winLossRatio: 1.0, gamesPlayed: 10, wins: 5, losses: 5, histoMatches: [ PlayerView(age: 18, winLossRatio: 1.0, gamesPlayed: 10, wins: 5, losses: 5, histoMatches: [
@ -31,10 +33,37 @@ struct PlayerListView: View {
Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3), Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3),
Match(gameEndScreen: "opponent3", opponent: "Opponent 3", selfScore: 2, opScore: 2) Match(gameEndScreen: "opponent3", opponent: "Opponent 3", selfScore: 2, opScore: 2)
], ],
playerVm: PlayerVM(with: Player(withName: "Toto", andId: .player2)!)) playerVm: PlayerVM(with: Player(withName: "Toto", andId: .player2)!)) //mettre player plus tard
} }
.navigationTitle("Leaderboard") .navigationTitle("Leaderboard")
List {
NavigationLink{
PlayerView(age: 18, winLossRatio: 1.0, gamesPlayed: 10, wins: 5, losses: 5, histoMatches: [
Match(gameEndScreen: "opponent1", opponent: "Opponent 1", selfScore: 3, opScore: 2),
Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3),
Match(gameEndScreen: "opponent3", opponent: "Opponent 3", selfScore: 2, opScore: 2)
],
playerVm: PlayerVM(with: Player(withName: "Billy", andId: .player2)!)) //mettre player plus tard
} label:{Text("pif")}
NavigationLink("Billy", value: "Billyname")
NavigationLink("Bob", value: "Bob")
NavigationLink("Bromingo", value: "Bromingo")
}
.navigationDestination(for: String.self) { name in
PlayerView(age: 18, winLossRatio: 1.0, gamesPlayed: 10, wins: 5, losses: 5, histoMatches: [
Match(gameEndScreen: "opponent1", opponent: "Opponent 1", selfScore: 3, opScore: 2),
Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3),
Match(gameEndScreen: "opponent3", opponent: "Opponent 3", selfScore: 2, opScore: 2)
],
playerVm: PlayerVM(with: Player(withName: "Toto", andId: .player2)!)) //mettre player plus tard
}
.navigationTitle("Leaderboard")
} }
VStack { VStack {

@ -1,95 +0,0 @@
//
// PlayerSelect.swift
// DouShouQiIOS
//
// Created by Pierre FERREIRA on 17/06/2024.
//
import SwiftUI
/// PlayerSelect
/// Cette vue est utilisée pour sélectionner un joueur
struct PlayerSelect: View {
@State private var image = UIImage()
@State private var showSheet = false
var versus : Bool
var body: some View {
ZStack {
Rectangle().fill(Color.bgColor).ignoresSafeArea()
VStack {
VStack{
Text("Joueur 1")
HStack {
Image(uiImage: self.image)
.resizable()
.cornerRadius(50)
.frame(width: 100, height: 100)
.background(Color.black.opacity(0.2))
.aspectRatio(contentMode: .fill)
.clipShape(Circle())
ClassicTextDisplay(text: "Change photo")
.onTapGesture {
showSheet = true
}
}
.padding(.horizontal, 20)
.sheet(isPresented: $showSheet) {
ImagePicker(sourceType: .photoLibrary, selectedImage: self.$image)
}
TextField("Entrez un nom ici",text: .constant(""))
}.foregroundStyle(.primary)
.padding(20)
.overlay(
RoundedRectangle(cornerRadius: 16)
.stroke(Color.player1, lineWidth: 5)
)
.padding(40)
if (versus){
VStack{
Text("Joueur 1")
HStack {
Image(uiImage: self.image)
.resizable()
.cornerRadius(50)
.frame(width: 100, height: 100)
.background(Color.black.opacity(0.2))
.aspectRatio(contentMode: .fill)
.clipShape(Circle())
ClassicTextDisplay(text: "Change photo")
.onTapGesture {
showSheet = true
}
}
.padding(.horizontal, 20)
.sheet(isPresented: $showSheet) {
ImagePicker(sourceType: .photoLibrary, selectedImage: self.$image)
}
TextField("Entrez un nom ici",text: .constant(""))
}.foregroundStyle(.primary)
.padding(20)
.overlay(
RoundedRectangle(cornerRadius: 16)
.stroke(Color.player2, lineWidth: 5)
)
.padding(40)
}
}
}
}
}
struct PlayerSelect_Previews: PreviewProvider {
static var previews: some View {
PlayerSelect(versus: true)
}
}

@ -8,8 +8,10 @@
import SwiftUI import SwiftUI
import DouShouQiModel import DouShouQiModel
/// Affiche les statistiques d'un joueur
struct PlayerView: View { struct PlayerView: View {
//var Player : Player;
//var name : String
var age: Int var age: Int
var winLossRatio: Double var winLossRatio: Double
var gamesPlayed: Int var gamesPlayed: Int
@ -19,8 +21,11 @@ struct PlayerView: View {
@State var isEdited : Bool = false @State var isEdited : Bool = false
@ObservedObject var playerVm : PlayerVM //TODO @ObservedObject var playerVm : PlayerVM //TODO
//@Published var data : Data
var body: some View { var body: some View {
//ZStack{
//Rectangle().fill(Color.bgColor).ignoresSafeArea()
VStack{ VStack{
VStack{ VStack{
Image("Blob") Image("Blob")
@ -93,17 +98,21 @@ struct PlayerView: View {
.padding(.top, 20) .padding(.top, 20)
} }
.toolbar { .toolbar {
//ToolbarItemGroup(placement: .bottomBar) {
Button(action: {isEdited.toggle()}, label: {Text("Edit")}) Button(action: {isEdited.toggle()}, label: {Text("Edit")})
//}
} }
.sheet(isPresented: $isEdited, content: { .sheet(isPresented: $isEdited, content: {
EditModalView(playerVM: playerVm, isEdited: $isEdited) EditModalView(playerVM: playerVm, isEdited: $isEdited)
}) })
//}//Zstack
} }
} }
struct PlayerView_Previews: PreviewProvider { struct PlayerView_Previews: PreviewProvider {
static var previews: some View { static var previews: some View {
/*var player1 = new Player(Player(withName: "Meruemu", andSName: "Roi", andId: 2, andAge: 1)*/
let stubedMatches = [ let stubedMatches = [
Match(gameEndScreen: "opponent1", opponent: "Opponent 1", selfScore: 3, opScore: 2), Match(gameEndScreen: "opponent1", opponent: "Opponent 1", selfScore: 3, opScore: 2),
Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3), Match(gameEndScreen: "opponent2", opponent: "Opponent 2", selfScore: 1, opScore: 3),

@ -8,11 +8,14 @@
import SwiftUI import SwiftUI
import SpriteKit import SpriteKit
///! TODELETE
struct SpriteKitView: View { struct SpriteKitView: View {
///Sprite Kit
var gs : GameScene = GameScene(size: CGSizeMake(940,740))
var body: some View { var body: some View {
VStack{ VStack{
SpriteView(scene: gs)
} }
} }
} }

@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Workspace <Workspace
version = "1.0"> version = "1.0">
<FileRef
location = "group:SwiftARKit/SwiftARKit.xcodeproj">
</FileRef>
<FileRef <FileRef
location = "group:DouShouQiIOS/DouShouQiIOS.xcodeproj"> location = "group:DouShouQiIOS/DouShouQiIOS.xcodeproj">
</FileRef> </FileRef>

@ -1,64 +1,2 @@
# SwiftUiTp # SwiftUiTp
Projet de DouShouQi avec SwiftUI-SpriteKit et ARKit
## Overview
Ce projet est une implémentation du jeu de société traditionnel chinois Dou Shou Qi, également connu sous le nom de Jeu de la Jungle, pour les appareils iOS. Il s'agit d'un jeu stratégique à deux joueurs dans lequel chaque joueur contrôle huit pions représentants différents animaux ayant des rangs et des pouvoirs variés. L'objectif est de capturer la tanière de l'adversaire ou d'éliminer toutes les pièces adverses.
## Technologies utilisées
- **Swift** : Le principal langage de programmation pour le développement d'applications iOS.
- **SpriteKit** : Une puissante infrastructure de rendu graphique et d'animation intégrée à iOS pour la création de jeux en 2D.
- **Xcode** : L'environnement de développement intégré (IDE) pour macOS, utilisé pour le développement d'applications iOS.
## Features
- Gestion d'un thème sombre en fonction du thème du device
- Menu
- Affichage d'une historique dynamique en fonction de données stubées
- ARKIT : Affichage d'une component Board dans un WorldPannel, sans la logique de jeu
- (SpriteKit) Affichage d'une board dynamique en 2D, mais lié qu'avec une partie des règles de jeu
- Jetons personnalisés
- Gestion des mouvements invalides
## Featuresn't
- L'applications n'a pas d'options multilingue
- Aucune persistance de données
- Création de joueur non géré
- Impossibilité de lancer une partie
- Impossibilité de lancer le jeu contre une IA
- Modification des joueurs commencée, mais abandonnée car j'ai perdu trop de temps dessus, et qu'il aurait fallu recoder le modèle pour cette simple fonctionnalité (cela m'a permis quand même de toucher au Binding)
## Erreur
Une erreur SIGABRT est levée lors d'une cast d'un ``Player?`` en ``HumainPlayer``, je n'ai pas réussi à régler ce problème.
Possible problèmes dû au nettoyage car aucuns test n'a été effectué ensuite.
# :construction_worker: Développeur
- Pierre FERREIRA : pierre.ferreira@etu.uca.fr
<div align="center">
<a href = "https://codefirst.iut.uca.fr/git/pierre.ferreira">
<img src="https://codefirst.iut.uca.fr/git/avatars/edbacace5f621ae77077f206ebdcee27?size=870" width="50" >
</a>
© IUT - Auvergne
</div>
---
<div style="display: flex; align-items: center;">
<p><i><strong>While writing this README, I was listening to...</strong></i></p>
<a href="https://www.youtube.com/watch?v=TaRleMb7eH0" target="_blank" style="text-decoration: none;">
<img src="https://img.youtube.com/vi/TaRleMb7eH0/0.jpg" alt="YouTube Thumbnail" style="width: 120px; margin-right: 10px;">
</a>
<div>
<p><strong>Pure Vessel - Hollow Knight OST Extended</strong></p>
<p><em>Team Cherry - (2017)</em></p>
</div>
</div>

@ -1,632 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 56;
objects = {
/* Begin PBXBuildFile section */
7B6A02792C18930200877E3F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A02782C18930200877E3F /* AppDelegate.swift */; };
7B6A027B2C18930200877E3F /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A027A2C18930200877E3F /* ContentView.swift */; };
7B6A027D2C18930200877E3F /* Experience.rcproject in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A027C2C18930200877E3F /* Experience.rcproject */; };
7B6A027F2C18930400877E3F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B6A027E2C18930400877E3F /* Assets.xcassets */; };
7B6A02822C18930400877E3F /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B6A02812C18930400877E3F /* Preview Assets.xcassets */; };
7B6A028C2C18930400877E3F /* SwiftARKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A028B2C18930400877E3F /* SwiftARKitTests.swift */; };
7B6A02962C18930400877E3F /* SwiftARKitUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A02952C18930400877E3F /* SwiftARKitUITests.swift */; };
7B6A02982C18930400877E3F /* SwiftARKitUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A02972C18930400877E3F /* SwiftARKitUITestsLaunchTests.swift */; };
7B6A02A82C18966400877E3F /* MySwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A02A72C18966400877E3F /* MySwiftUIView.swift */; };
7B6A02AC2C18A1B000877E3F /* MyARViewRepresentable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B6A02AB2C18A1B000877E3F /* MyARViewRepresentable.swift */; };
F0A2577F2C297CDF006C9826 /* board.usdz in Resources */ = {isa = PBXBuildFile; fileRef = F0A2577E2C297CDF006C9826 /* board.usdz */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
7B6A02882C18930400877E3F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 7B6A026D2C18930200877E3F /* Project object */;
proxyType = 1;
remoteGlobalIDString = 7B6A02742C18930200877E3F;
remoteInfo = SwiftARKit;
};
7B6A02922C18930400877E3F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 7B6A026D2C18930200877E3F /* Project object */;
proxyType = 1;
remoteGlobalIDString = 7B6A02742C18930200877E3F;
remoteInfo = SwiftARKit;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
7B6A02752C18930200877E3F /* SwiftARKit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SwiftARKit.app; sourceTree = BUILT_PRODUCTS_DIR; };
7B6A02782C18930200877E3F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7B6A027A2C18930200877E3F /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
7B6A027C2C18930200877E3F /* Experience.rcproject */ = {isa = PBXFileReference; lastKnownFileType = file.rcproject; path = Experience.rcproject; sourceTree = "<group>"; };
7B6A027E2C18930400877E3F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7B6A02812C18930400877E3F /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
7B6A02872C18930400877E3F /* SwiftARKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftARKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7B6A028B2C18930400877E3F /* SwiftARKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftARKitTests.swift; sourceTree = "<group>"; };
7B6A02912C18930400877E3F /* SwiftARKitUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftARKitUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
7B6A02952C18930400877E3F /* SwiftARKitUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftARKitUITests.swift; sourceTree = "<group>"; };
7B6A02972C18930400877E3F /* SwiftARKitUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftARKitUITestsLaunchTests.swift; sourceTree = "<group>"; };
7B6A02A72C18966400877E3F /* MySwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MySwiftUIView.swift; sourceTree = "<group>"; };
7B6A02A92C189ED700877E3F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
7B6A02AB2C18A1B000877E3F /* MyARViewRepresentable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MyARViewRepresentable.swift; sourceTree = "<group>"; };
F0A2577E2C297CDF006C9826 /* board.usdz */ = {isa = PBXFileReference; lastKnownFileType = file.usdz; name = board.usdz; path = objects/board.usdz; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
7B6A02722C18930200877E3F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7B6A02842C18930400877E3F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7B6A028E2C18930400877E3F /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
7B6A026C2C18930200877E3F = {
isa = PBXGroup;
children = (
7B6A02772C18930200877E3F /* SwiftARKit */,
7B6A028A2C18930400877E3F /* SwiftARKitTests */,
7B6A02942C18930400877E3F /* SwiftARKitUITests */,
7B6A02762C18930200877E3F /* Products */,
);
sourceTree = "<group>";
};
7B6A02762C18930200877E3F /* Products */ = {
isa = PBXGroup;
children = (
7B6A02752C18930200877E3F /* SwiftARKit.app */,
7B6A02872C18930400877E3F /* SwiftARKitTests.xctest */,
7B6A02912C18930400877E3F /* SwiftARKitUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
7B6A02772C18930200877E3F /* SwiftARKit */ = {
isa = PBXGroup;
children = (
F0A2577E2C297CDF006C9826 /* board.usdz */,
7B6A02AA2C18A19C00877E3F /* Struct */,
7B6A02A92C189ED700877E3F /* Info.plist */,
7B6A02A62C18964F00877E3F /* View */,
7B6A02782C18930200877E3F /* AppDelegate.swift */,
7B6A027A2C18930200877E3F /* ContentView.swift */,
7B6A027C2C18930200877E3F /* Experience.rcproject */,
7B6A027E2C18930400877E3F /* Assets.xcassets */,
7B6A02802C18930400877E3F /* Preview Content */,
);
path = SwiftARKit;
sourceTree = "<group>";
};
7B6A02802C18930400877E3F /* Preview Content */ = {
isa = PBXGroup;
children = (
7B6A02812C18930400877E3F /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
7B6A028A2C18930400877E3F /* SwiftARKitTests */ = {
isa = PBXGroup;
children = (
7B6A028B2C18930400877E3F /* SwiftARKitTests.swift */,
);
path = SwiftARKitTests;
sourceTree = "<group>";
};
7B6A02942C18930400877E3F /* SwiftARKitUITests */ = {
isa = PBXGroup;
children = (
7B6A02952C18930400877E3F /* SwiftARKitUITests.swift */,
7B6A02972C18930400877E3F /* SwiftARKitUITestsLaunchTests.swift */,
);
path = SwiftARKitUITests;
sourceTree = "<group>";
};
7B6A02A62C18964F00877E3F /* View */ = {
isa = PBXGroup;
children = (
7B6A02A72C18966400877E3F /* MySwiftUIView.swift */,
);
path = View;
sourceTree = "<group>";
};
7B6A02AA2C18A19C00877E3F /* Struct */ = {
isa = PBXGroup;
children = (
7B6A02AB2C18A1B000877E3F /* MyARViewRepresentable.swift */,
);
path = Struct;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
7B6A02742C18930200877E3F /* SwiftARKit */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7B6A029B2C18930400877E3F /* Build configuration list for PBXNativeTarget "SwiftARKit" */;
buildPhases = (
7B6A02712C18930200877E3F /* Sources */,
7B6A02722C18930200877E3F /* Frameworks */,
7B6A02732C18930200877E3F /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = SwiftARKit;
productName = SwiftARKit;
productReference = 7B6A02752C18930200877E3F /* SwiftARKit.app */;
productType = "com.apple.product-type.application";
};
7B6A02862C18930400877E3F /* SwiftARKitTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7B6A029E2C18930400877E3F /* Build configuration list for PBXNativeTarget "SwiftARKitTests" */;
buildPhases = (
7B6A02832C18930400877E3F /* Sources */,
7B6A02842C18930400877E3F /* Frameworks */,
7B6A02852C18930400877E3F /* Resources */,
);
buildRules = (
);
dependencies = (
7B6A02892C18930400877E3F /* PBXTargetDependency */,
);
name = SwiftARKitTests;
productName = SwiftARKitTests;
productReference = 7B6A02872C18930400877E3F /* SwiftARKitTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
7B6A02902C18930400877E3F /* SwiftARKitUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 7B6A02A12C18930400877E3F /* Build configuration list for PBXNativeTarget "SwiftARKitUITests" */;
buildPhases = (
7B6A028D2C18930400877E3F /* Sources */,
7B6A028E2C18930400877E3F /* Frameworks */,
7B6A028F2C18930400877E3F /* Resources */,
);
buildRules = (
);
dependencies = (
7B6A02932C18930400877E3F /* PBXTargetDependency */,
);
name = SwiftARKitUITests;
productName = SwiftARKitUITests;
productReference = 7B6A02912C18930400877E3F /* SwiftARKitUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
7B6A026D2C18930200877E3F /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1420;
TargetAttributes = {
7B6A02742C18930200877E3F = {
CreatedOnToolsVersion = 14.2;
};
7B6A02862C18930400877E3F = {
CreatedOnToolsVersion = 14.2;
TestTargetID = 7B6A02742C18930200877E3F;
};
7B6A02902C18930400877E3F = {
CreatedOnToolsVersion = 14.2;
TestTargetID = 7B6A02742C18930200877E3F;
};
};
};
buildConfigurationList = 7B6A02702C18930200877E3F /* Build configuration list for PBXProject "SwiftARKit" */;
compatibilityVersion = "Xcode 14.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 7B6A026C2C18930200877E3F;
productRefGroup = 7B6A02762C18930200877E3F /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
7B6A02742C18930200877E3F /* SwiftARKit */,
7B6A02862C18930400877E3F /* SwiftARKitTests */,
7B6A02902C18930400877E3F /* SwiftARKitUITests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
7B6A02732C18930200877E3F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F0A2577F2C297CDF006C9826 /* board.usdz in Resources */,
7B6A02822C18930400877E3F /* Preview Assets.xcassets in Resources */,
7B6A027F2C18930400877E3F /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
7B6A02852C18930400877E3F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
7B6A028F2C18930400877E3F /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
7B6A02712C18930200877E3F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7B6A027B2C18930200877E3F /* ContentView.swift in Sources */,
7B6A02792C18930200877E3F /* AppDelegate.swift in Sources */,
7B6A02AC2C18A1B000877E3F /* MyARViewRepresentable.swift in Sources */,
7B6A02A82C18966400877E3F /* MySwiftUIView.swift in Sources */,
7B6A027D2C18930200877E3F /* Experience.rcproject in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
7B6A02832C18930400877E3F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7B6A028C2C18930400877E3F /* SwiftARKitTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
7B6A028D2C18930400877E3F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7B6A02982C18930400877E3F /* SwiftARKitUITestsLaunchTests.swift in Sources */,
7B6A02962C18930400877E3F /* SwiftARKitUITests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
7B6A02892C18930400877E3F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 7B6A02742C18930200877E3F /* SwiftARKit */;
targetProxy = 7B6A02882C18930400877E3F /* PBXContainerItemProxy */;
};
7B6A02932C18930400877E3F /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 7B6A02742C18930200877E3F /* SwiftARKit */;
targetProxy = 7B6A02922C18930400877E3F /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
7B6A02992C18930400877E3F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
name = Debug;
};
7B6A029A2C18930400877E3F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
7B6A029C2C18930400877E3F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SwiftARKit/Preview Content\"";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 67U885533Q;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SwiftARKit/Info.plist;
INFOPLIST_KEY_NSCameraUsageDescription = "Camera needed for AR app";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiredDeviceCapabilities = arkit;
INFOPLIST_KEY_UIStatusBarHidden = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = fr.uca.iut.SwiftARKit;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = tpiOS_2024_06_21_off;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
7B6A029D2C18930400877E3F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"SwiftARKit/Preview Content\"";
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 67U885533Q;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SwiftARKit/Info.plist;
INFOPLIST_KEY_NSCameraUsageDescription = "Camera needed for AR app";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UIRequiredDeviceCapabilities = arkit;
INFOPLIST_KEY_UIStatusBarHidden = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = fr.uca.iut.SwiftARKit;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
"PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = tpiOS_2024_06_21_off;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
7B6A029F2C18930400877E3F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = PierreFerreira.SwiftARKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftARKit.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SwiftARKit";
};
name = Debug;
};
7B6A02A02C18930400877E3F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 16.2;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = PierreFerreira.SwiftARKitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SwiftARKit.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/SwiftARKit";
};
name = Release;
};
7B6A02A22C18930400877E3F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = PierreFerreira.SwiftARKitUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = SwiftARKit;
};
name = Debug;
};
7B6A02A32C18930400877E3F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = PierreFerreira.SwiftARKitUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = SwiftARKit;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
7B6A02702C18930200877E3F /* Build configuration list for PBXProject "SwiftARKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7B6A02992C18930400877E3F /* Debug */,
7B6A029A2C18930400877E3F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7B6A029B2C18930400877E3F /* Build configuration list for PBXNativeTarget "SwiftARKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7B6A029C2C18930400877E3F /* Debug */,
7B6A029D2C18930400877E3F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7B6A029E2C18930400877E3F /* Build configuration list for PBXNativeTarget "SwiftARKitTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7B6A029F2C18930400877E3F /* Debug */,
7B6A02A02C18930400877E3F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
7B6A02A12C18930400877E3F /* Build configuration list for PBXNativeTarget "SwiftARKitUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
7B6A02A22C18930400877E3F /* Debug */,
7B6A02A32C18930400877E3F /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 7B6A026D2C18930200877E3F /* Project object */;
}

@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7B6A02742C18930200877E3F"
BuildableName = "SwiftARKit.app"
BlueprintName = "SwiftARKit"
ReferencedContainer = "container:SwiftARKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7B6A02862C18930400877E3F"
BuildableName = "SwiftARKitTests.xctest"
BlueprintName = "SwiftARKitTests"
ReferencedContainer = "container:SwiftARKit.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7B6A02902C18930400877E3F"
BuildableName = "SwiftARKitUITests.xctest"
BlueprintName = "SwiftARKitUITests"
ReferencedContainer = "container:SwiftARKit.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7B6A02742C18930200877E3F"
BuildableName = "SwiftARKit.app"
BlueprintName = "SwiftARKit"
ReferencedContainer = "container:SwiftARKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7B6A02742C18930200877E3F"
BuildableName = "SwiftARKit.app"
BlueprintName = "SwiftARKit"
ReferencedContainer = "container:SwiftARKit.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

@ -1,48 +0,0 @@
//
// AppDelegate.swift
// SwiftARKit
//
// Created by Pierre FERREIRA on 11/06/2024.
//
import UIKit
import SwiftUI
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView()
// Use a UIHostingController as window root view controller.
let window = UIWindow(frame: UIScreen.main.bounds)
window.rootViewController = UIHostingController(rootView: contentView)
self.window = window
window.makeKeyAndVisible()
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
}

@ -1,11 +0,0 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -1,13 +0,0 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -1,6 +0,0 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -1,13 +0,0 @@
{
"data" : [
{
"filename" : "tv_retro.usdz",
"idiom" : "universal",
"universal-type-identifier" : "com.pixar.universal-scene-description-mobile"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -1,21 +0,0 @@
{
"images" : [
{
"filename" : "board.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

@ -1,45 +0,0 @@
//
// ContentView.swift
// SwiftARKit
//
// Created by Pierre FERREIRA on 11/06/2024.
//
import SwiftUI
import RealityKit
struct ContentView : View {
var body: some View {
//ARViewContainer().edgesIgnoringSafeArea(.all)
MyARViewRepresentable().edgesIgnoringSafeArea(.all)
}
}
struct ARViewContainer: UIViewRepresentable {
func makeUIView(context: Context) -> ARView {
let arView = ARView(frame: .zero)
// Load the "Box" scene from the "Experience" Reality File
let boxAnchor = try! Experience.loadBox()
// Add the box anchor to the scene
arView.scene.anchors.append(boxAnchor)
return arView
}
func updateUIView(_ uiView: ARView, context: Context) {}
}
#if DEBUG
struct ContentView_Previews : PreviewProvider {
static var previews: some View {
ContentView()
}
}
#endif

@ -1,4 +0,0 @@
{
"LibraryID" : "BBB5EDD2-CBE1-49E5-931D-2C81F724D19D",
"Version" : "1.0"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

@ -1,155 +0,0 @@
{
"__version" : 1,
"__content" : [
{
"tags" : {
"__version" : 1,
"__content" : [
{
"tagsStore" : {
}
}
]
},
"scenes" : [
{
"__version" : 2,
"__content" : [
{
"hasGroundPlane" : true,
"gravity" : [
0,
-9.8000001907348633,
0
],
"arAnchorSpecification" : {
"name" : "surface",
"classification" : 0,
"alignment" : 1
},
"title" : "Box",
"material" : "concrete",
"layoutData" : {
"version" : 1,
"constraints" : [
]
},
"identifier" : "F9610871-0955-494F-A5C3-51D1A281BAB3",
"behaviors" : [
],
"overrides" : {
"factory" : null,
"children" : {
"4A213441-135C-450E-8EF8-1A4EAB267C1D" : {
"overrides" : {
"factory" : {
"version" : "1.0",
"identifier" : "com.apple.rc.af.CoreAssetFactories.PrimitiveShapeAssetFactory"
},
"arguments" : [
[
"material",
{
"value" : "steel",
"typeName" : "String"
}
],
[
"type",
{
"value" : "box",
"typeName" : "String"
}
]
],
"runtimeAttributes" : [
[
"RuntimeIdentifier",
{
"value" : "3788A5B5-0388-488A-8304-7B90FEBA6FAC",
"typeName" : "UUID"
}
],
[
"entityName",
{
"value" : "Steel Box",
"typeName" : "String"
}
]
]
},
"transform" : {
"matrix" : [
1,
0,
0,
0,
0,
1,
0,
0,
0,
0,
1,
0,
0,
0.05000000074505806,
0,
1
]
}
},
"B91C7CA3-4AB1-4253-9A84-07383168A8A8" : null,
"7F5F1ADC-E5E4-4EF5-A5B5-FC43B071FFA5" : null,
"632E476F-1E55-4E30-9723-1C51DD2E8B89" : null
}
},
"viewTransform" : {
"sceneTransform" : [
1,
0,
0,
0,
0,
0.99999994039535522,
0,
0,
0,
0,
0.99999994039535522,
0,
0,
0,
0,
1
],
"cameraTransform" : [
0.99999994039535522,
0,
0,
0,
0,
0.80754852294921875,
-0.58980101346969604,
0,
0,
0.58980101346969604,
0.80754852294921875,
0,
0,
1.135667085647583,
1.5549418926239014,
1
]
}
}
]
}
]
}
]
}

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>

@ -1,6 +0,0 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

@ -1,33 +0,0 @@
//
// MyARView.swift
// SwiftARKit
//
// Created by Pierre FERREIRA on 11/06/2024.
//
import SwiftUI
import ARKit
import RealityKit
struct MyARViewRepresentable : UIViewRepresentable{
public func makeUIView(context: Context) -> MyARView {
//
// let arView = MyARView(frame: .zero)
// let mesh = MeshResource.generateBox(size: 0.1, cornerRadius: 0.005)
//
// //let mesh = MeshResource.generateBox(width: 150, height: 500, depth: 50)
// let material = SimpleMaterial(color: .red, isMetallic: true)
// let model = ModelEntity(mesh: mesh, materials: [material]) //, materials: material
// model.transform.translation.y = 0.05
//
// let anchor = AnchorEntity(.plane(.horizontal, classification: .table, minimumBounds: .zero))
//
// arView.scene.anchors.append(anchor)
// return arView
//
return MyARView()
}
public func updateUIView(_ uiView: UIViewType, context: Context) { }
}

@ -1,99 +0,0 @@
//
// MySwiftUIView.swift
// SwiftARKit
//
// Created by Pierre FERREIRA on 11/06/2024.
//
import SwiftUI
import ARKit
import RealityKit
class MyARView : ARView{
required init (frame frameRect : CGRect){
super.init(frame: frameRect)
}
required init?(coder decoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
convenience init() {
self.init(frame: UIScreen.main.bounds)
addBoardToTheFloor()
addMeepleToBoard()
}
///Repère où attacher le plan
func applyRunConfiguration(){
//ARWorldTrackingConfiguration.self
let conf = ARWorldTrackingConfiguration()
//conf.planeDetection = .horizontal
session.run(conf)
}
func defineAnchors() {
let anchor = AnchorEntity(world: .zero)
scene.addAnchor(anchor)
}
func addBoardToTheFloor() {
//let configuration = ARWorldTrackingConfiguration()
//session.run(configuration)
let anchor = AnchorEntity(.plane(.horizontal, classification: .any, minimumBounds: SIMD2<Float>(0.2, 0.2)))
scene.addAnchor(anchor)
let board = try? Entity.load(named: "board")
if let board {
anchor.addChild(board)
}
}
func addMeepleToBoard(){ //boardAnchor : AnchorEntity
//let configuration = ARWorldTrackingConfiguration()
//session.run(configuration)
let objectsName = [ "rat", "cat", "dog", "wolf", "leopard", "tiger", "lion", "elephant"]
var iterator : Int = 0
let anchor = AnchorEntity(.plane(.horizontal, classification: .any, minimumBounds: SIMD2<Float>(0.3, 0.3))) //Une anchor par case ou une pour tout le plateau ?
scene.addAnchor(anchor)
/// TODO : Lier au model ?
for row in 0...7{
for col in 0...7{
if (col % 2 == row % 2 ){
let meeple = try? Entity.load(named: objectsName[iterator % 7]) //miteux
iterator += 1
if let meeple {
meeple.position.x += 0.1145 * Float(row)
meeple.position.y += 0.1145 * Float(col)
anchor.addChild(meeple)
}
}
}
}
}
// func createAnchor(){
// let anchor : AnchorEntity = AnchorEntity(world: .zero)
// self.scene.addAnchor(anchor)
//
// let mesh = MeshResource.generateBox(size: 10)
// let material = SimpleMaterial(color: .red, isMetallic: true)
// let model = ModelEntity(mesh: mesh, materials: [material])
// model.transform.translation.y = 0.05
//
// anchor.addChild(model)
//
//// let tv = try? Entity.load(named: "Data")
//// anchor.addChild(tv!)
//
// }
}

@ -1,36 +0,0 @@
//
// SwiftARKitTests.swift
// SwiftARKitTests
//
// Created by Pierre FERREIRA on 11/06/2024.
//
import XCTest
@testable import SwiftARKit
final class SwiftARKitTests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
// Any test you write for XCTest can be annotated as throws and async.
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error.
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards.
}
func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}
}

@ -1,41 +0,0 @@
//
// SwiftARKitUITests.swift
// SwiftARKitUITests
//
// Created by Pierre FERREIRA on 11/06/2024.
//
import XCTest
final class SwiftARKitUITests: XCTestCase {
override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
// In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false
// In UI tests its important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}
override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
app.launch()
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testLaunchPerformance() throws {
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
// This measures how long it takes to launch your application.
measure(metrics: [XCTApplicationLaunchMetric()]) {
XCUIApplication().launch()
}
}
}
}

@ -1,32 +0,0 @@
//
// SwiftARKitUITestsLaunchTests.swift
// SwiftARKitUITests
//
// Created by Pierre FERREIRA on 11/06/2024.
//
import XCTest
final class SwiftARKitUITestsLaunchTests: XCTestCase {
override class var runsForEachTargetApplicationUIConfiguration: Bool {
true
}
override func setUpWithError() throws {
continueAfterFailure = false
}
func testLaunch() throws {
let app = XCUIApplication()
app.launch()
// Insert steps here to perform after app launch but before taking a screenshot,
// such as logging into a test account or navigating somewhere in the app
let attachment = XCTAttachment(screenshot: app.screenshot())
attachment.name = "Launch Screen"
attachment.lifetime = .keepAlways
add(attachment)
}
}
Loading…
Cancel
Save