diff --git a/App/App/SpriteKit/GameScene.swift b/App/App/SpriteKit/GameScene.swift new file mode 100644 index 0000000..86aa604 --- /dev/null +++ b/App/App/SpriteKit/GameScene.swift @@ -0,0 +1,22 @@ +import SpriteKit + +public class GameScene : SKScene { + public override init(size: CGSize) { + super.init(size: size) + + anchorPoint = CGPoint(x: 0.5, y: 0.5) + + backgroundColor = .cyan + + let rect = SKShapeNode(rect: CGRect(x: 10, y: 10, width: 100, height: 100)) + rect.strokeColor = .clear + rect.fillColor = .red + + addChild(rect) + } + + public required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + } +} + diff --git a/App/App/View/IngameView.swift b/App/App/View/IngameView.swift index d2b7c56..d0a9ac9 100644 --- a/App/App/View/IngameView.swift +++ b/App/App/View/IngameView.swift @@ -6,8 +6,11 @@ // import SwiftUI +import SpriteKit struct IngameView: View { + private let scene: GameScene = GameScene(size: CGSize(width: 700, height: 600)) + var body: some View { HStack { PlayerView(is_local: true) @@ -17,7 +20,7 @@ struct IngameView: View { Spacer() - Rectangle().aspectRatio(contentMode: .fit) + SpriteView(scene: self.scene).aspectRatio(contentMode: .fit) Spacer()