Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import UIKit
import ImagineEngine

@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
let scene = ___PACKAGENAME___Scene(size: UIScreen.main.bounds.size)

let window = GameWindow(scene: scene)
window.makeKeyAndVisible()
self.window = window

return true
}
}
7 changes: 7 additions & 0 deletions XcodeTemplates/Imagine Engine/tvOS Game.xctemplate/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
platform :tvos, '10.0'

target '___PACKAGENAME___' do
use_frameworks!
pod 'ImagineEngine'
end

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?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>
<key>Kind</key>
<string>Xcode.Xcode3.ProjectTemplateUnitKind</string>
<key>Identifier</key>
<string>com.ImagineEngine.Templates.tvOS</string>
<key>Ancestors</key>
<array>
<string>com.apple.dt.unit.tvosApplicationBase</string>
</array>
<key>Concrete</key>
<true/>
<key>Description</key>
<string>This template provides a starting point for an tvOS game powered by Imagine Engine.</string>
<key>Options</key>
<array>
<dict>
<key>Identifier</key>
<string>languageChoice</string>
<key>Units</key>
<dict>
<key>Swift</key>
<dict>
<key>Nodes</key>
<array>
<string>___PACKAGENAME___Scene.swift</string>
<string>../Podfile</string>
</array>
</dict>
</dict>
</dict>
</array>
<key>Definitions</key>
<dict>
<key>AppDelegate.swift</key>
<dict>
<key>Path</key>
<string>AppDelegate.swift</string>
</dict>
<key>___PACKAGENAME___Scene.swift</key>
<dict>
<key>Path</key>
<string>___PACKAGENAME___Scene.swift</string>
</dict>
<key>../Podfile</key>
<dict>
<key>Path</key>
<string>Podfile</string>
</dict>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import ImagineEngine

// A scene acts as a container for your game objects, much like a view controller
// in a tvOS app. You can move between different scene's in a game, so you can
// split your game's menus & levels up into multiple scenes.
final class ___PACKAGENAME___Scene: Scene {
override func setup() {
// Actors are the core objects of any game, they represent all movable &
// scriptable objects - like players, enemies & collectables.
let actor = Actor()
actor.backgroundColor = .red
actor.size = Size(width: 100, height: 100)
actor.position = center
add(actor)

// Actions enable you to move, rotate & scale your game objects over
// time. You can also define your own actions using the `Action` class
actor.repeat(RotateAction(delta: .pi * 2, duration: 2))

// Labels let you easily add text to your game's scenes
let label = Label(text: "Hello Imagine Engine!")
label.font = .boldSystemFont(ofSize: 20)
label.position = center
add(label)

// Events let you script your game by reacting to things like user input
// or when two objects collided. Each game object has an `events` property
// where you can find all observable events for that object.
events.clicked.addObserver(actor) { actor in
func randomColorValue() -> Metric {
return Metric(arc4random_uniform(101)) / 100
}

actor.backgroundColor = Color(
red: randomColorValue(),
green: randomColorValue(),
blue: randomColorValue(),
alpha: 1
)
}
}
}
1 change: 1 addition & 0 deletions XcodeTemplates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Done! 👌

- Open Xcode and select `New > Project...`.
- Under the "iOS" tab, scroll down to the "Imagine Engine" section and select "iOS Game".
- _For tvOS; Select the "tvOS" tab, scroll down to the "Imagine Engine" section and select "tvOS Game"_
- Enter a name for your game and make sure to select "Swift" as language.
- Xcode will now create a project for you. Close the project and go to the project's folder on the command line.
- Run `pod install`. This will install Imagine Engine through [CocoaPods](https://cocoapods.org).
Expand Down