Skip to content

Commit

Permalink
Initial iOS/tvOS port
Browse files Browse the repository at this point in the history
  • Loading branch information
andoma committed Apr 12, 2016
1 parent 5b42800 commit 96359b7
Show file tree
Hide file tree
Showing 45 changed files with 5,954 additions and 42 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ debian/changelog
android/Showtime/bin/
android/Showtime/gen/
android/Showtime/libs/
*.xcuserstate
project.xcworkspace/
xcuserdata/
InfoPlist.h
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@
[submodule "android"]
path = android
url = [email protected]:movian-android.git
[submodule "ios/freetype2-ios"]
path = ios/freetype2-ios
url = https://github.com/andoma/freetype2-ios.git
11 changes: 11 additions & 0 deletions Autobuild/ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set -e
BUILDDIR="${PWD}/build.ios"

rm -rf "${BUILDDIR}"
mkdir -p "${BUILDDIR}"

(cd ios && xcodebuild archive -scheme Movian -archivePath "${BUILDDIR}/app")

(cd ios && xcodebuild -exportArchive -archivePath "${BUILDDIR}/app.xcarchive" -exportPath "${BUILDDIR}/" -exportOptionsPlist nobitcode.plist)

artifact build.ios/Movian.ipa ipa application/octet-stream Movian.ipa
24 changes: 24 additions & 0 deletions ios/Movian-tvOS/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BV1-FR-VrT">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Game View Controller-->
<scene sceneID="tXr-a1-R10">
<objects>
<viewController id="BV1-FR-VrT" customClass="GameViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gUg-lF-avW"/>
<viewControllerLayoutGuide type="bottom" id="9uR-A8-SVe"/>
</layoutGuides>
<glkView key="view" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" enableSetNeedsDisplay="NO" id="DqR-QF-hDF">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</glkView>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
32 changes: 32 additions & 0 deletions ios/Movian-tvOS/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?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>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Movian</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>GIT_REVISION</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
</dict>
</plist>
3,192 changes: 3,192 additions & 0 deletions ios/Movian.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions ios/Movian/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// AppDelegate.h
// Movian
//
// Created by Andreas Öman on 03/06/15.
// Copyright (c) 2015 Lonelycoder AB. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

121 changes: 121 additions & 0 deletions ios/Movian/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//
// AppDelegate.m
// Movian
//
// Created by Andreas Öman on 03/06/15.
// Copyright (c) 2015 Lonelycoder AB. All rights reserved.
//

#import "AppDelegate.h"

#include <unistd.h>
#include <sys/stat.h>
#include <stdio.h>

#include "arch/posix/posix.h"
#include "main.h"
#include "service.h"


const char *htsversion;
const char *htsversion_full;

uint32_t
parse_version_int(const char *str)
{
int major = 0;
int minor = 0;
int commit = 0;
sscanf(str, "%d.%d.%d", &major, &minor, &commit);

return
major * 10000000 +
minor * 100000 +
commit;
}

uint32_t
app_get_version_int(void)
{
return parse_version_int(htsversion);
}



@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.

char path[PATH_MAX];

NSDictionary* infoDict = [[NSBundle mainBundle] infoDictionary];
NSString* version = [infoDict objectForKey:@"CFBundleShortVersionString"];
htsversion_full = htsversion = strdup([version UTF8String]);

gconf.concurrency = (int)[[NSProcessInfo processInfo] activeProcessorCount];

#ifdef TARGET_OS_TV
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
#else
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES);
#endif
NSString *libraryDirectory = [paths objectAtIndex:0];
snprintf(path, sizeof(path), "%s/persistent", [libraryDirectory UTF8String]);
mkdir(path, 0777);
gconf.persistent_path = strdup(path);

paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
libraryDirectory = [paths objectAtIndex:0];
snprintf(path, sizeof(path), "%s/cache", [libraryDirectory UTF8String]);
mkdir(path, 0777);
gconf.cache_path = strdup(path);

posix_init();

main_init();

paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *docsdir = [paths objectAtIndex:0];

service_createp("Files", _p("Files"), [docsdir UTF8String],
"files", NULL, 0, 1, SVC_ORIGIN_SYSTEM);

[UIApplication sharedApplication].idleTimerDisabled = YES;

return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
// 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game.
printf("%s\n", __FUNCTION__);
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
// 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.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
printf("%s\n", __FUNCTION__);
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
printf("%s\n", __FUNCTION__);
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
// 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.
printf("%s\n", __FUNCTION__);
}

- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
printf("%s\n", __FUNCTION__);
}

@end
19 changes: 19 additions & 0 deletions ios/Movian/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
26 changes: 26 additions & 0 deletions ios/Movian/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BV1-FR-VrT">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Game View Controller-->
<scene sceneID="tXr-a1-R10">
<objects>
<viewController id="BV1-FR-VrT" customClass="GameViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="8aa-yV-Osq"/>
<viewControllerLayoutGuide type="bottom" id="qHh-Mt-9TT"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="3se-qz-xqx" customClass="GLKView">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
14 changes: 14 additions & 0 deletions ios/Movian/GameViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// GameViewController.h
// Movian
//
// Created by Andreas Öman on 03/06/15.
// Copyright (c) 2015 Lonelycoder AB. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>

@interface GameViewController : GLKViewController

@end
Loading

0 comments on commit 96359b7

Please sign in to comment.