Added EmulationViewController, displays ControllerView
This commit is contained in:
parent
cc5d2cc627
commit
f615b65f5e
@ -1 +1 @@
|
||||
Subproject commit 0fe20409850d1d4c1b3bd4f40d304eace2346eec
|
||||
Subproject commit cb3e98f268e615aac3906572fa001ada5e99eadc
|
||||
@ -19,6 +19,8 @@
|
||||
BFFA71E21AAC406100EE9DD1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BFFA71E01AAC406100EE9DD1 /* Main.storyboard */; };
|
||||
BFFA71E41AAC406100EE9DD1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BFFA71E31AAC406100EE9DD1 /* Images.xcassets */; };
|
||||
BFFA71E71AAC406100EE9DD1 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BFFA71E51AAC406100EE9DD1 /* LaunchScreen.xib */; };
|
||||
BFFB709F1AF99B1700DE56FE /* EmulationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFFB709E1AF99B1700DE56FE /* EmulationViewController.swift */; };
|
||||
BFFB70A11AF99DFB00DE56FE /* EmulationViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = BFFB70A01AF99DFB00DE56FE /* EmulationViewController.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -49,6 +51,8 @@
|
||||
BFFA71E11AAC406100EE9DD1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
BFFA71E31AAC406100EE9DD1 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
|
||||
BFFA71E61AAC406100EE9DD1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
|
||||
BFFB709E1AF99B1700DE56FE /* EmulationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmulationViewController.swift; sourceTree = "<group>"; };
|
||||
BFFB70A01AF99DFB00DE56FE /* EmulationViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = EmulationViewController.xib; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -115,6 +119,7 @@
|
||||
BFFA71DC1AAC406100EE9DD1 /* AppDelegate.swift */,
|
||||
BFFA71E01AAC406100EE9DD1 /* Main.storyboard */,
|
||||
BF46894D1AAC469800A2586D /* Game Selection */,
|
||||
BFFB709D1AF99ACA00DE56FE /* Emulation */,
|
||||
BFEC732F1AAECCBD00650035 /* Resources */,
|
||||
BFFA71DA1AAC406100EE9DD1 /* Supporting Files */,
|
||||
);
|
||||
@ -130,6 +135,15 @@
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
BFFB709D1AF99ACA00DE56FE /* Emulation */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BFFB709E1AF99B1700DE56FE /* EmulationViewController.swift */,
|
||||
BFFB70A01AF99DFB00DE56FE /* EmulationViewController.xib */,
|
||||
);
|
||||
name = Emulation;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -157,6 +171,7 @@
|
||||
BFFA71CF1AAC406100EE9DD1 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 0700;
|
||||
LastUpgradeCheck = 0630;
|
||||
ORGANIZATIONNAME = "Riley Testut";
|
||||
TargetAttributes = {
|
||||
@ -189,6 +204,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BFFA71E21AAC406100EE9DD1 /* Main.storyboard in Resources */,
|
||||
BFFB70A11AF99DFB00DE56FE /* EmulationViewController.xib in Resources */,
|
||||
BFFA71E71AAC406100EE9DD1 /* LaunchScreen.xib in Resources */,
|
||||
BFFA71E41AAC406100EE9DD1 /* Images.xcassets in Resources */,
|
||||
);
|
||||
@ -202,6 +218,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BFFA71DF1AAC406100EE9DD1 /* GamesViewController.swift in Sources */,
|
||||
BFFB709F1AF99B1700DE56FE /* EmulationViewController.swift in Sources */,
|
||||
BFFA71DD1AAC406100EE9DD1 /* AppDelegate.swift in Sources */,
|
||||
BF46894F1AAC46EF00A2586D /* DirectoryContentsDataSource.swift in Sources */,
|
||||
);
|
||||
@ -290,7 +307,7 @@
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
|
||||
77
Delta/EmulationViewController.swift
Normal file
77
Delta/EmulationViewController.swift
Normal file
@ -0,0 +1,77 @@
|
||||
//
|
||||
// EmulationViewController.swift
|
||||
// Delta
|
||||
//
|
||||
// Created by Riley Testut on 5/5/15.
|
||||
// Copyright (c) 2015 Riley Testut. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import DeltaCore
|
||||
import SNESDeltaCore
|
||||
|
||||
class EmulationViewController: UIViewController
|
||||
{
|
||||
let game: Game
|
||||
let emulatorCore: EmulatorCore
|
||||
@IBOutlet private(set) var controllerView: ControllerView!
|
||||
|
||||
@IBOutlet private var controllerViewHeightConstraint: NSLayoutConstraint!
|
||||
|
||||
required init(game: Game)
|
||||
{
|
||||
self.game = game
|
||||
self.emulatorCore = SNESEmulatorCore(game: game)
|
||||
|
||||
super.init(nibName: "EmulationViewController", bundle: nil)
|
||||
}
|
||||
|
||||
required init(coder aDecoder: NSCoder) {
|
||||
fatalError("initWithCoder: not implemented.")
|
||||
}
|
||||
|
||||
//MARK: UIViewController
|
||||
|
||||
override func viewDidLoad()
|
||||
{
|
||||
super.viewDidLoad()
|
||||
|
||||
let skinURL = self.game.URL.URLByDeletingLastPathComponent?.URLByAppendingPathComponent("Standard.deltaskin")
|
||||
let controllerSkin = ControllerSkin(URL: skinURL!)
|
||||
|
||||
self.controllerView.controllerSkin = controllerSkin
|
||||
|
||||
println(self.controllerView.intrinsicContentSize())
|
||||
}
|
||||
|
||||
override func viewDidAppear(animated: Bool)
|
||||
{
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
self.emulatorCore.startEmulation()
|
||||
}
|
||||
|
||||
override func viewDidLayoutSubviews()
|
||||
{
|
||||
super.viewDidLayoutSubviews()
|
||||
|
||||
let scale = self.view.bounds.width / self.controllerView.intrinsicContentSize().width
|
||||
self.controllerViewHeightConstraint.constant = self.controllerView.intrinsicContentSize().height * scale
|
||||
}
|
||||
|
||||
override func willTransitionToTraitCollection(newCollection: UITraitCollection, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator)
|
||||
{
|
||||
super.willTransitionToTraitCollection(newCollection, withTransitionCoordinator: coordinator)
|
||||
|
||||
self.controllerView.beginAnimatingUpdateControllerSkin()
|
||||
|
||||
coordinator.animateAlongsideTransition(nil) { (context) in
|
||||
self.controllerView.finishAnimatingUpdateControllerSkin()
|
||||
}
|
||||
}
|
||||
|
||||
override func prefersStatusBarHidden() -> Bool
|
||||
{
|
||||
return true
|
||||
}
|
||||
}
|
||||
52
Delta/EmulationViewController.xib
Normal file
52
Delta/EmulationViewController.xib
Normal file
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7702"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="EmulationViewController" customModule="Delta" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="controllerView" destination="vwI-ri-b2R" id="ntJ-HT-evx"/>
|
||||
<outlet property="controllerViewHeightConstraint" destination="6qz-Ae-arR" id="H8i-pm-31E"/>
|
||||
<outlet property="view" destination="iN0-l3-epB" id="eD5-dV-r00"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" placeholderIntrinsicWidth="600" placeholderIntrinsicHeight="300" translatesAutoresizingMaskIntoConstraints="NO" id="vwI-ri-b2R" customClass="ControllerView" customModule="DeltaCore">
|
||||
<rect key="frame" x="0.0" y="300" width="600" height="300"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="300" id="6qz-Ae-arR"/>
|
||||
</constraints>
|
||||
<variation key="heightClass=compact">
|
||||
<mask key="constraints">
|
||||
<exclude reference="6qz-Ae-arR"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="vwI-ri-b2R" secondAttribute="bottom" id="Blz-Nt-ex2"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vwI-ri-b2R" secondAttribute="trailing" id="YbQ-Se-7bk"/>
|
||||
<constraint firstItem="vwI-ri-b2R" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="ZYq-E4-bHb"/>
|
||||
<constraint firstItem="vwI-ri-b2R" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="mX7-Cl-eSm"/>
|
||||
</constraints>
|
||||
<nil key="simulatedStatusBarMetrics"/>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="ZYq-E4-bHb"/>
|
||||
</mask>
|
||||
</variation>
|
||||
<variation key="heightClass=compact">
|
||||
<mask key="constraints">
|
||||
<include reference="ZYq-E4-bHb"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
@ -76,8 +76,8 @@ class GamesViewController: UITableViewController
|
||||
{
|
||||
if let URL = self.directoryContentsDataSource?.URLAtIndexPath(indexPath), game = Game(URL: URL) where game.UTI != kUTTypeDeltaGame as String
|
||||
{
|
||||
println(game.name)
|
||||
let emulatorCore = EmulatorCore(game: game)
|
||||
let emulationViewController = EmulationViewController(game: game)
|
||||
self.presentViewController(emulationViewController, animated: true, completion: nil)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user