Skip to content

Commit

Permalink
feat: packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
markusyeo committed Jun 27, 2024
1 parent d39bd46 commit 29136f9
Show file tree
Hide file tree
Showing 21 changed files with 109 additions and 85 deletions.
40 changes: 34 additions & 6 deletions ArkGames.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
28E65B142BCEDF7F00AF69B4 /* snake_green_head.png in Resources */ = {isa = PBXBuildFile; fileRef = 28E65B112BCEDF7F00AF69B4 /* snake_green_head.png */; };
28E65B162BCEDF9700AF69B4 /* apple_alt.png in Resources */ = {isa = PBXBuildFile; fileRef = 28E65B152BCEDF9700AF69B4 /* apple_alt.png */; };
28EFCB1D2BCC3C4E0059A908 /* ArkDemoMultiplayerPopover.swift in Sources */ = {isa = PBXBuildFile; fileRef = 28EFCB1C2BCC3C4E0059A908 /* ArkDemoMultiplayerPopover.swift */; };
28FAA3E42C2DE63D00D2B9F3 /* ArkKit in Frameworks */ = {isa = PBXBuildFile; productRef = 28FAA3E32C2DE63D00D2B9F3 /* ArkKit */; };
28FAA3E62C2DE64000D2B9F3 /* DequeModule in Frameworks */ = {isa = PBXBuildFile; productRef = 28FAA3E52C2DE64000D2B9F3 /* DequeModule */; };
8F3813052BCE755A0058E107 /* Ground_Tile_01_A.png in Resources */ = {isa = PBXBuildFile; fileRef = 8F3812FF2BCE755A0058E107 /* Ground_Tile_01_A.png */; };
8F3813062BCE755A0058E107 /* Ground_Tile_01_B.png in Resources */ = {isa = PBXBuildFile; fileRef = 8F3813002BCE755A0058E107 /* Ground_Tile_01_B.png */; };
8F3813072BCE755A0058E107 /* Ground_Tile_02_C.png in Resources */ = {isa = PBXBuildFile; fileRef = 8F3813012BCE755A0058E107 /* Ground_Tile_02_C.png */; };
Expand Down Expand Up @@ -230,7 +232,6 @@
2812FCC22BC4395D00A0FE24 /* TankRaceGameCollisionStrategyManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TankRaceGameCollisionStrategyManager.swift; sourceTree = "<group>"; };
2812FCC42BC4424200A0FE24 /* TankRaceGameEntityCreator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TankRaceGameEntityCreator.swift; sourceTree = "<group>"; };
2812FCC62BC442BD00A0FE24 /* TankRaceGameTerrainObjectBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TankRaceGameTerrainObjectBuilder.swift; sourceTree = "<group>"; };
285ABB222C2DE20800CF4C05 /* ArkGames.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = ArkGames.app; path = "/Users/markus/Downloads/ArkKit/build/Debug-iphoneos/ArkGames.app"; sourceTree = "<absolute>"; };
286C09BF2BADD0BB000343B1 /* TankGameMapBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TankGameMapBuilder.swift; sourceTree = "<group>"; };
286C09C12BADD5FB000343B1 /* TankGameTerrainObjectBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TankGameTerrainObjectBuilder.swift; sourceTree = "<group>"; };
286F6E2D2BCFAAC900B857C5 /* TankHealthPackGeneratorComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TankHealthPackGeneratorComponent.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -262,6 +263,7 @@
28E65B112BCEDF7F00AF69B4 /* snake_green_head.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = snake_green_head.png; sourceTree = "<group>"; };
28E65B152BCEDF9700AF69B4 /* apple_alt.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = apple_alt.png; sourceTree = "<group>"; };
28EFCB1C2BCC3C4E0059A908 /* ArkDemoMultiplayerPopover.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArkDemoMultiplayerPopover.swift; sourceTree = "<group>"; };
28FAA3E12C2DE5A200D2B9F3 /* ArkGames.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ArkGames.app; sourceTree = BUILT_PRODUCTS_DIR; };
8F3812FF2BCE755A0058E107 /* Ground_Tile_01_A.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Ground_Tile_01_A.png; sourceTree = "<group>"; };
8F3813002BCE755A0058E107 /* Ground_Tile_01_B.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Ground_Tile_01_B.png; sourceTree = "<group>"; };
8F3813012BCE755A0058E107 /* Ground_Tile_02_C.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Ground_Tile_02_C.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -333,6 +335,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
28FAA3E42C2DE63D00D2B9F3 /* ArkKit in Frameworks */,
28FAA3E62C2DE64000D2B9F3 /* DequeModule in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -567,6 +571,13 @@
path = Events;
sourceTree = "<group>";
};
28FAA3E22C2DE63D00D2B9F3 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
sourceTree = "<group>";
};
941A45AC2BCD4D9000689D15 /* FlappyBird */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -812,6 +823,8 @@
02D8E91D2BAC419400BF3A07 /* assets */,
02C395312BA9ED230075F1CA /* README.md */,
02C395102BA6EBBA0075F1CA /* ArkGameExample */,
28FAA3E12C2DE5A200D2B9F3 /* ArkGames.app */,
28FAA3E22C2DE63D00D2B9F3 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand All @@ -833,9 +846,11 @@
);
name = ArkGames;
packageProductDependencies = (
28FAA3E32C2DE63D00D2B9F3 /* ArkKit */,
28FAA3E52C2DE64000D2B9F3 /* DequeModule */,
);
productName = LevelKit;
productReference = 285ABB222C2DE20800CF4C05 /* ArkGames.app */;
productReference = 28FAA3E12C2DE5A200D2B9F3 /* ArkGames.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand Down Expand Up @@ -1218,7 +1233,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 879B4J7JQ8;
DEVELOPMENT_TEAM = "";
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ArkGameExample/Info.plist;
Expand All @@ -1233,7 +1248,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = ArkKit.markus;
PRODUCT_BUNDLE_IDENTIFIER = ArkKit.arkkit;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
Expand All @@ -1252,7 +1267,7 @@
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = 879B4J7JQ8;
DEVELOPMENT_TEAM = "";
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ArkGameExample/Info.plist;
Expand All @@ -1267,7 +1282,7 @@
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = ArkKit.markus;
PRODUCT_BUNDLE_IDENTIFIER = ArkKit.arkkit;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
Expand Down Expand Up @@ -1319,6 +1334,19 @@
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
28FAA3E32C2DE63D00D2B9F3 /* ArkKit */ = {
isa = XCSwiftPackageProductDependency;
package = 285856B82C2DC2FC008ADE71 /* XCLocalSwiftPackageReference "ArkKit" */;
productName = ArkKit;
};
28FAA3E52C2DE64000D2B9F3 /* DequeModule */ = {
isa = XCSwiftPackageProductDependency;
package = 945441182BC9497900E90ECE /* XCRemoteSwiftPackageReference "swift-collections" */;
productName = DequeModule;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = AD787A452B9C636F003EBBD0 /* Project object */;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ArkSetUpIfHostStrategy<View, ExternalResources: ArkExternalResources>: Ark
}

func setUp() {
let startingSetUpStrategy = ArkSetUpWithoutNetwork(ark: ark)
let startingSetUpStrategy = ArkSetUpWithoutNetworkStrategy(ark: ark)
startingSetUpStrategy.setUp()
guard let ark = ark,
let networkPlayableInfo = ark.blueprint.networkPlayableInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ struct ArkSetUpOrchestrator<View, ExternalResources: ArkExternalResources> {
func executeSetUp() {
guard let networkPlayableInfo = ark?.blueprint.networkPlayableInfo else {
// no network playable set
let noNetworkSetUpStrategy = ArkSetUpWithoutNetwork(ark: ark)
let noNetworkSetUpStrategy = ArkSetUpWithoutNetworkStrategy(ark: ark)
noNetworkSetUpStrategy.setUp()
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ArkSetUpWithoutNetwork<View, ExternalResources: ArkExternalResources>: ArkSetUpStrategy {
class ArkSetUpWithoutNetworkStrategy<View, ExternalResources: ArkExternalResources>: ArkSetUpStrategy {
weak var ark: Ark<View, ExternalResources>?

init(ark: Ark<View, ExternalResources>? = nil) {
Expand Down
6 changes: 3 additions & 3 deletions ArkKit/Sources/ArkKit/ark-camera-kit/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public struct Camera: Codable {
public let zoom: CameraZoom

public init(canvasPosition: CGPoint,
zoom: Double = 1.0) {
zoom: Double = 1.0) {
self.canvasPosition = canvasPosition
self.zoom = CameraZoom(widthZoom: zoom, heightZoom: zoom)
}

public init(canvasPosition: CGPoint,
zoomWidth: Double = 1.0,
zoomHeight: Double = 1.0) {
zoomWidth: Double = 1.0,
zoomHeight: Double = 1.0) {
self.canvasPosition = canvasPosition
self.zoom = CameraZoom(widthZoom: zoomWidth,
heightZoom: zoomHeight)
Expand Down
10 changes: 5 additions & 5 deletions ArkKit/Sources/ArkKit/ark-event-kit/ArkEventManager.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Foundation

struct DatedEvent {
let event: any ArkEvent
let timestamp: Date
var priority: Int?
public struct DatedEvent {
public let event: any ArkEvent
public let timestamp: Date
public var priority: Int?

init(event: any ArkEvent, timestamp: Date = Date(), priority: Int? = nil) {
public init(event: any ArkEvent, timestamp: Date = Date(), priority: Int? = nil) {
self.event = event
self.timestamp = timestamp
self.priority = priority ?? event.priority
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ public protocol ArkExternalResources {

public struct NoExternalResources: ArkExternalResources {
public var audioEnum: NoAudio

public init() {
self.audioEnum = .none
}
}
2 changes: 0 additions & 2 deletions ArkKit/Sources/ArkKit/ark-game/view/ArkViewFactory.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#if canImport(UIKit)
import UIKit
#endif

class ArkViewFactory {
static func generateView<T>(_ parentView: any AbstractParentView<T>) -> (any ArkView<T>)? {
Expand Down
2 changes: 0 additions & 2 deletions ArkKit/Sources/ArkKit/ark-game/view/ui-kit/ArkUIKitView.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#if canImport(UIKit)
import UIKit
#endif

/**
* `ArkUIKitView` is the main page that will render the game's canvas.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
protocol GameLoopEventData: ArkEventData {
public protocol GameLoopEventData: ArkEventData {
var timeInGame: Double { get }
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
struct PauseGameLoopEventData: GameLoopEventData {
let timeInGame: Double
var name: String = "PauseGame"
public struct PauseGameLoopEventData: GameLoopEventData {
public let timeInGame: Double
public var name: String = "PauseGame"

public init(timeInGame: Double) {
self.timeInGame = timeInGame
}
}
struct PauseGameLoopEvent: ArkEvent {
var eventData: PauseGameLoopEventData
var priority: Int?

public struct PauseGameLoopEvent: ArkEvent {
public var eventData: PauseGameLoopEventData
public var priority: Int?

public init(timeInGame: Double, priority: Int? = nil ) {
self.eventData = PauseGameLoopEventData(timeInGame: timeInGame)
self.priority = priority
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
struct ResumeGameLoopEventData: GameLoopEventData {
let timeInGame: Double
var name: String = "ResumeGame"
public struct ResumeGameLoopEventData: GameLoopEventData {
public let timeInGame: Double
public var name: String = "ResumeGame"

public init(timeInGame: Double) {
self.timeInGame = timeInGame
}
}
struct ResumeGameLoopEvent: ArkEvent {
var eventData: ResumeGameLoopEventData
var priority: Int?

public struct ResumeGameLoopEvent: ArkEvent {
public var eventData: ResumeGameLoopEventData
public var priority: Int?

public init(timeInGame: Double, priority: Int? = nil) {
self.eventData = ResumeGameLoopEventData(timeInGame: timeInGame)
self.priority = priority
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#if canImport(UIKit)
import UIKit
#endif

import P2PShare

/**
Expand Down
20 changes: 10 additions & 10 deletions ArkKit/Sources/ArkKit/ark-physics-kit/PhysicsComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public struct PhysicsComponent: SendableComponent {
public var vertices: [CGPoint]?

public var mass: CGFloat?
public var velocity: CGVector = .zero
public var isDynamic = true
public var affectedByGravity = false
public var linearDamping: CGFloat = .zero
public var angularDamping: CGFloat = .zero
public var allowsRotation = false
public var friction: CGFloat = .zero
public var restitution: CGFloat = .zero
public var impulse: CGVector = .zero
public var angularImpulse: CGFloat = .zero
public var velocity: CGVector
public var isDynamic: Bool
public var affectedByGravity: Bool
public var linearDamping: CGFloat
public var angularDamping: CGFloat
public var allowsRotation: Bool
public var friction: CGFloat
public var restitution: CGFloat
public var impulse: CGVector
public var angularImpulse: CGFloat

public var categoryBitMask: UInt32
public var collisionBitMask: UInt32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ public struct CircleRenderableComponent: ShapeRenderableComponent {
public var labelInfo: ShapeLabelInfo?

public init(radius: Double, fillInfo: ShapeFillInfo? = nil,
strokeInfo: ShapeStrokeInfo? = nil,
labelInfo: ShapeLabelInfo? = nil) {
strokeInfo: ShapeStrokeInfo? = nil,
labelInfo: ShapeLabelInfo? = nil) {
self.radius = radius
self.fillInfo = fillInfo
self.strokeInfo = strokeInfo
self.labelInfo = labelInfo
}

public func modify(fillInfo: ShapeFillInfo?, strokeInfo: ShapeStrokeInfo?,
labelInfo: ShapeLabelInfo?) -> CircleRenderableComponent {
labelInfo: ShapeLabelInfo?) -> CircleRenderableComponent {
var copy = self
copy.fillInfo = fillInfo
copy.strokeInfo = strokeInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public struct PolygonRenderableComponent: ShapeRenderableComponent {
public var labelInfo: ShapeLabelInfo?

public init(points: [CGPoint], frame: CGRect,
fillInfo: ShapeFillInfo? = nil,
strokeInfo: ShapeStrokeInfo? = nil,
labelInfo: ShapeLabelInfo? = nil) {
fillInfo: ShapeFillInfo? = nil,
strokeInfo: ShapeStrokeInfo? = nil,
labelInfo: ShapeLabelInfo? = nil) {
self.points = points
self.frame = frame
self.center = CGPoint(x: frame.midX, y: frame.midY)
Expand All @@ -29,7 +29,7 @@ public struct PolygonRenderableComponent: ShapeRenderableComponent {
}

public func modify(fillInfo: ShapeFillInfo?, strokeInfo: ShapeStrokeInfo?,
labelInfo: ShapeLabelInfo?) -> PolygonRenderableComponent {
labelInfo: ShapeLabelInfo?) -> PolygonRenderableComponent {
var copy = self

copy.fillInfo = fillInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public struct RectRenderableComponent: ShapeRenderableComponent {
public var labelInfo: ShapeLabelInfo?

public init(width: Double, height: Double,
fillInfo: ShapeFillInfo? = nil,
strokeInfo: ShapeStrokeInfo? = nil,
labelInfo: ShapeLabelInfo? = nil) {
fillInfo: ShapeFillInfo? = nil,
strokeInfo: ShapeStrokeInfo? = nil,
labelInfo: ShapeLabelInfo? = nil) {
self.width = width
self.height = height
self.fillInfo = fillInfo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

public protocol ShapeRenderableComponent: AbstractShape, AbstractTappable, RenderableComponent where Color == AbstractColor {
public protocol ShapeRenderableComponent: AbstractShape, AbstractTappable,
RenderableComponent where Color == AbstractColor {
var fillInfo: ShapeFillInfo? { get }
var strokeInfo: ShapeStrokeInfo? { get }
var labelInfo: ShapeLabelInfo? { get }
Expand All @@ -26,7 +27,7 @@ extension ShapeRenderableComponent {
}

public func upsert(fillInfo: ShapeFillInfo? = nil, strokeInfo: ShapeStrokeInfo? = nil,
labelInfo: ShapeLabelInfo? = nil) -> Self {
labelInfo: ShapeLabelInfo? = nil) -> Self {
modify(
fillInfo: fillInfo ?? self.fillInfo,
strokeInfo: strokeInfo ?? self.strokeInfo,
Expand Down
Loading

0 comments on commit 29136f9

Please sign in to comment.