add iOS support

This commit is contained in:
2017-05-07 23:49:46 +01:00
parent b50011babf
commit d1ce547abd
16 changed files with 682 additions and 20 deletions

17
PanoPainter/AppDelegate.h Normal file
View File

@@ -0,0 +1,17 @@
//
// AppDelegate.h
// PanoPainter
//
// Created by Omar Mohamed Ali Mudhir on 07/05/17.
// Copyright © 2017 Omar Mohamed Ali Mudhir. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

45
PanoPainter/AppDelegate.m Normal file
View File

@@ -0,0 +1,45 @@
//
// AppDelegate.m
// PanoPainter
//
// Created by Omar Mohamed Ali Mudhir on 07/05/17.
// Copyright © 2017 Omar Mohamed Ali Mudhir. All rights reserved.
//
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
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.
}
- (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.
}
- (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.
}
- (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.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
@end

View File

@@ -0,0 +1,73 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -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="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BV1-FR-VrT">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</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>

View File

@@ -0,0 +1,14 @@
//
// GameViewController.h
// PanoPainter
//
// Created by Omar Mohamed Ali Mudhir on 07/05/17.
// Copyright © 2017 Omar Mohamed Ali Mudhir. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
@interface GameViewController : GLKViewController
@end

View File

@@ -0,0 +1,119 @@
//
// GameViewController.m
// PanoPainter
//
// Created by Omar Mohamed Ali Mudhir on 07/05/17.
// Copyright © 2017 Omar Mohamed Ali Mudhir. All rights reserved.
//
#include "pch.h"
#import "GameViewController.h"
#import <OpenGLES/ES3/glext.h>
#include "app.h"
@interface GameViewController () {
}
@property (strong, nonatomic) EAGLContext *context;
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator;
- (void)setupGL;
- (void)tearDownGL;
//- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
@end
@implementation GameViewController
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
float scale = self.view.contentScaleFactor;
App::I.mouse_move(touchLocation.x * scale, touchLocation.y * scale);
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
App::I.resize(size.width * self.view.contentScaleFactor,
size.height * self.view.contentScaleFactor);
}
- (void)viewDidLoad
{
[super viewDidLoad];
App::I.initLog();
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];
if (!self.context) {
NSLog(@"Failed to create ES context");
}
GLKView *view = (GLKView *)self.view;
view.context = self.context;
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
App::I.width = view.frame.size.width * view.contentScaleFactor;
App::I.height = view.frame.size.height * view.contentScaleFactor;
[self setupGL];
}
- (void)dealloc
{
[self tearDownGL];
if ([EAGLContext currentContext] == self.context) {
[EAGLContext setCurrentContext:nil];
}
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
if ([self isViewLoaded] && ([[self view] window] == nil)) {
self.view = nil;
[self tearDownGL];
if ([EAGLContext currentContext] == self.context) {
[EAGLContext setCurrentContext:nil];
}
self.context = nil;
}
// Dispose of any resources that can be recreated.
}
- (BOOL)prefersStatusBarHidden {
return YES;
}
- (void)setupGL
{
[EAGLContext setCurrentContext:self.context];
App::I.init();
}
- (void)tearDownGL
{
[EAGLContext setCurrentContext:self.context];
}
#pragma mark - GLKView and GLKViewController delegate methods
- (void)update
{
}
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
{
App::I.clear();
App::I.update(0);
}
@end

49
PanoPainter/Info.plist Normal file
View File

@@ -0,0 +1,49 @@
<?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>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UIStatusBarHidden</key>
<true/>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

16
PanoPainter/main.m Normal file
View File

@@ -0,0 +1,16 @@
//
// main.m
// PanoPainter
//
// Created by Omar Mohamed Ali Mudhir on 07/05/17.
// Copyright © 2017 Omar Mohamed Ali Mudhir. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@@ -14,6 +14,7 @@
AD4C08DB1E89BD0F0051D85F /* brush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D31E89BD0F0051D85F /* brush.cpp */; };
AD4C08DC1E89BD0F0051D85F /* canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D51E89BD0F0051D85F /* canvas.cpp */; };
AD4C08DD1E89BD0F0051D85F /* rtt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D71E89BD0F0051D85F /* rtt.cpp */; };
AD5016591EBFC7F00079A826 /* data in Resources */ = {isa = PBXBuildFile; fileRef = AD58E0611E17F23D006ACC15 /* data */; };
AD58E0531E107411006ACC15 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0521E107411006ACC15 /* main.cpp */; };
AD58E05A1E10752E006ACC15 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD58E0591E10752E006ACC15 /* OpenGL.framework */; };
AD58E05C1E107536006ACC15 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD58E05B1E107536006ACC15 /* Cocoa.framework */; };
@@ -35,6 +36,42 @@
AD95AEC71E41EDEC002DD03A /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC51E41EDEC002DD03A /* pch.cpp */; };
ADB1C3DA1EA3A156009A65BD /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB1C3D81EA3A156009A65BD /* event.cpp */; };
ADB61C821E3D38450093280F /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB61C801E3D38450093280F /* util.cpp */; };
ADD7D26F1EBF9AE300D5A897 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD7D26E1EBF9AE300D5A897 /* main.m */; };
ADD7D2721EBF9AE300D5A897 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD7D2711EBF9AE300D5A897 /* AppDelegate.m */; };
ADD7D2791EBF9AE300D5A897 /* GameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = ADD7D2781EBF9AE300D5A897 /* GameViewController.m */; };
ADD7D27C1EBF9AE300D5A897 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ADD7D27A1EBF9AE300D5A897 /* Main.storyboard */; };
ADD7D27E1EBF9AE300D5A897 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = ADD7D27D1EBF9AE300D5A897 /* Assets.xcassets */; };
ADD7D2811EBF9AE300D5A897 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ADD7D27F1EBF9AE300D5A897 /* LaunchScreen.storyboard */; };
ADD7D2871EBF9C6700D5A897 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D2861EBF9C6700D5A897 /* Foundation.framework */; };
ADD7D2891EBF9D2A00D5A897 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D2881EBF9D2A00D5A897 /* OpenGLES.framework */; };
ADD7D28B1EBF9D5D00D5A897 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D28A1EBF9D5D00D5A897 /* UIKit.framework */; };
ADD7D28D1EBF9D6F00D5A897 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D28C1EBF9D6F00D5A897 /* CoreFoundation.framework */; };
ADD7D28F1EBF9D8C00D5A897 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D28E1EBF9D8C00D5A897 /* GLKit.framework */; };
ADD7D2901EBF9E1C00D5A897 /* canvas_modes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD744B6C1EBC9EF700B66E30 /* canvas_modes.cpp */; };
ADD7D2911EBF9E1C00D5A897 /* event.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB1C3D81EA3A156009A65BD /* event.cpp */; };
ADD7D2921EBF9E1C00D5A897 /* action.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD29CC601EA2B214008C8BFA /* action.cpp */; };
ADD7D2931EBF9E1C00D5A897 /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD8CF71F1E913F0500083FFD /* log.cpp */; };
ADD7D2941EBF9E1C00D5A897 /* asset.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08CF1E89BD0F0051D85F /* asset.cpp */; };
ADD7D2951EBF9E1C00D5A897 /* bezier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D11E89BD0F0051D85F /* bezier.cpp */; };
ADD7D2961EBF9E1C00D5A897 /* brush.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D31E89BD0F0051D85F /* brush.cpp */; };
ADD7D2971EBF9E1C00D5A897 /* canvas.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D51E89BD0F0051D85F /* canvas.cpp */; };
ADD7D2981EBF9E1C00D5A897 /* rtt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD4C08D71E89BD0F0051D85F /* rtt.cpp */; };
ADD7D2991EBF9E1C00D5A897 /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC31E41EDEC002DD03A /* font.cpp */; };
ADD7D29A1EBF9E1C00D5A897 /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC51E41EDEC002DD03A /* pch.cpp */; };
ADD7D29B1EBF9E1C00D5A897 /* layout.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD3B1EBE1E3B8B7600E918E3 /* layout.cpp */; };
ADD7D29C1EBF9E1C00D5A897 /* shader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0631E2A76FD006ACC15 /* shader.cpp */; };
ADD7D29D1EBF9E1C00D5A897 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0521E107411006ACC15 /* main.cpp */; };
ADD7D29E1EBF9E1C00D5A897 /* shape.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E06D1E2A80BC006ACC15 /* shape.cpp */; };
ADD7D29F1EBF9E1C00D5A897 /* app.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0701E2A90EF006ACC15 /* app.cpp */; };
ADD7D2A01EBF9E1C00D5A897 /* image.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0661E2A7741006ACC15 /* image.cpp */; };
ADD7D2A11EBF9E1C00D5A897 /* texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0691E2A774F006ACC15 /* texture.cpp */; };
ADD7D2A21EBF9E1C00D5A897 /* util.cpp in Sources */ = {isa = PBXBuildFile; fileRef = ADB61C801E3D38450093280F /* util.cpp */; };
ADD7D2A31EBFA06F00D5A897 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0781E342205006ACC15 /* tinyxml2.cpp */; };
ADD7D2A41EBFA06F00D5A897 /* YGNodeList.c in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0741E3421F2006ACC15 /* YGNodeList.c */; };
ADD7D2A51EBFA06F00D5A897 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0751E3421F2006ACC15 /* Yoga.c */; };
ADD7D2AF1EBFA35F00D5A897 /* libcurl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D2AE1EBFA35F00D5A897 /* libcurl.a */; };
ADD7D2B11EBFA42600D5A897 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D2B01EBFA42600D5A897 /* libz.tbd */; };
ADD7D2B31EBFA42C00D5A897 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ADD7D2B21EBFA42C00D5A897 /* Security.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -55,7 +92,7 @@
AD29CC611EA2B214008C8BFA /* action.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = action.h; sourceTree = "<group>"; };
AD3B1EBE1E3B8B7600E918E3 /* layout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = layout.cpp; sourceTree = "<group>"; };
AD3B1EBF1E3B8B7600E918E3 /* layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = layout.h; sourceTree = "<group>"; };
AD4C08CF1E89BD0F0051D85F /* asset.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = asset.cpp; sourceTree = "<group>"; };
AD4C08CF1E89BD0F0051D85F /* asset.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = asset.cpp; sourceTree = "<group>"; };
AD4C08D01E89BD0F0051D85F /* asset.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asset.h; sourceTree = "<group>"; };
AD4C08D11E89BD0F0051D85F /* bezier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bezier.cpp; sourceTree = "<group>"; };
AD4C08D21E89BD0F0051D85F /* bezier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bezier.h; sourceTree = "<group>"; };
@@ -99,6 +136,24 @@
ADB1C3DB1EA531B0009A65BD /* keymap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keymap.h; sourceTree = "<group>"; };
ADB61C801E3D38450093280F /* util.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = util.cpp; sourceTree = "<group>"; };
ADB61C811E3D38450093280F /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = util.h; sourceTree = "<group>"; };
ADD7D26B1EBF9AE300D5A897 /* PanoPainter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PanoPainter.app; sourceTree = BUILT_PRODUCTS_DIR; };
ADD7D26E1EBF9AE300D5A897 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
ADD7D2701EBF9AE300D5A897 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
ADD7D2711EBF9AE300D5A897 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
ADD7D2771EBF9AE300D5A897 /* GameViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GameViewController.h; sourceTree = "<group>"; };
ADD7D2781EBF9AE300D5A897 /* GameViewController.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = GameViewController.m; sourceTree = "<group>"; };
ADD7D27B1EBF9AE300D5A897 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
ADD7D27D1EBF9AE300D5A897 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
ADD7D2801EBF9AE300D5A897 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
ADD7D2821EBF9AE300D5A897 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
ADD7D2861EBF9C6700D5A897 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
ADD7D2881EBF9D2A00D5A897 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
ADD7D28A1EBF9D5D00D5A897 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
ADD7D28C1EBF9D6F00D5A897 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/CoreFoundation.framework; sourceTree = DEVELOPER_DIR; };
ADD7D28E1EBF9D8C00D5A897 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/GLKit.framework; sourceTree = DEVELOPER_DIR; };
ADD7D2AE1EBFA35F00D5A897 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = "../../Downloads/curl-android-ios-master/prebuilt-with-ssl/iOS/x86_64/libcurl.a"; sourceTree = "<group>"; };
ADD7D2B01EBFA42600D5A897 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };
ADD7D2B21EBFA42C00D5A897 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.2.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -114,13 +169,36 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
ADD7D2681EBF9AE300D5A897 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ADD7D2B31EBFA42C00D5A897 /* Security.framework in Frameworks */,
ADD7D2B11EBFA42600D5A897 /* libz.tbd in Frameworks */,
ADD7D28F1EBF9D8C00D5A897 /* GLKit.framework in Frameworks */,
ADD7D28D1EBF9D6F00D5A897 /* CoreFoundation.framework in Frameworks */,
ADD7D28B1EBF9D5D00D5A897 /* UIKit.framework in Frameworks */,
ADD7D2891EBF9D2A00D5A897 /* OpenGLES.framework in Frameworks */,
ADD7D2871EBF9C6700D5A897 /* Foundation.framework in Frameworks */,
ADD7D2AF1EBFA35F00D5A897 /* libcurl.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
AD58E0461E107411006ACC15 = {
isa = PBXGroup;
children = (
ADD7D2B21EBFA42C00D5A897 /* Security.framework */,
ADD7D2B01EBFA42600D5A897 /* libz.tbd */,
ADD7D28E1EBF9D8C00D5A897 /* GLKit.framework */,
ADD7D28C1EBF9D6F00D5A897 /* CoreFoundation.framework */,
ADD7D28A1EBF9D5D00D5A897 /* UIKit.framework */,
ADD7D2881EBF9D2A00D5A897 /* OpenGLES.framework */,
ADD7D2861EBF9C6700D5A897 /* Foundation.framework */,
AD8CF7221E914DE400083FFD /* libcurl.tbd */,
ADD7D2AE1EBFA35F00D5A897 /* libcurl.a */,
AD58E0731E3421CB006ACC15 /* libs */,
AD58E0611E17F23D006ACC15 /* data */,
AD58E05F1E12DA86006ACC15 /* CoreVideo.framework */,
@@ -128,6 +206,7 @@
AD58E05B1E107536006ACC15 /* Cocoa.framework */,
AD58E0591E10752E006ACC15 /* OpenGL.framework */,
AD58E0511E107411006ACC15 /* engine */,
ADD7D26C1EBF9AE300D5A897 /* PanoPainter */,
AD58E0501E107411006ACC15 /* Products */,
);
sourceTree = "<group>";
@@ -136,6 +215,7 @@
isa = PBXGroup;
children = (
AD58E04F1E107411006ACC15 /* engine */,
ADD7D26B1EBF9AE300D5A897 /* PanoPainter.app */,
);
name = Products;
sourceTree = "<group>";
@@ -195,6 +275,30 @@
name = libs;
sourceTree = "<group>";
};
ADD7D26C1EBF9AE300D5A897 /* PanoPainter */ = {
isa = PBXGroup;
children = (
ADD7D2701EBF9AE300D5A897 /* AppDelegate.h */,
ADD7D2711EBF9AE300D5A897 /* AppDelegate.m */,
ADD7D2771EBF9AE300D5A897 /* GameViewController.h */,
ADD7D2781EBF9AE300D5A897 /* GameViewController.m */,
ADD7D27A1EBF9AE300D5A897 /* Main.storyboard */,
ADD7D27D1EBF9AE300D5A897 /* Assets.xcassets */,
ADD7D27F1EBF9AE300D5A897 /* LaunchScreen.storyboard */,
ADD7D2821EBF9AE300D5A897 /* Info.plist */,
ADD7D26D1EBF9AE300D5A897 /* Supporting Files */,
);
path = PanoPainter;
sourceTree = "<group>";
};
ADD7D26D1EBF9AE300D5A897 /* Supporting Files */ = {
isa = PBXGroup;
children = (
ADD7D26E1EBF9AE300D5A897 /* main.m */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -215,6 +319,23 @@
productReference = AD58E04F1E107411006ACC15 /* engine */;
productType = "com.apple.product-type.tool";
};
ADD7D26A1EBF9AE300D5A897 /* PanoPainter */ = {
isa = PBXNativeTarget;
buildConfigurationList = ADD7D2851EBF9AE300D5A897 /* Build configuration list for PBXNativeTarget "PanoPainter" */;
buildPhases = (
ADD7D2671EBF9AE300D5A897 /* Sources */,
ADD7D2681EBF9AE300D5A897 /* Frameworks */,
ADD7D2691EBF9AE300D5A897 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = PanoPainter;
productName = PanoPainter;
productReference = ADD7D26B1EBF9AE300D5A897 /* PanoPainter.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@@ -227,6 +348,9 @@
AD58E04E1E107411006ACC15 = {
CreatedOnToolsVersion = 7.2;
};
ADD7D26A1EBF9AE300D5A897 = {
CreatedOnToolsVersion = 7.2;
};
};
};
buildConfigurationList = AD58E04A1E107411006ACC15 /* Build configuration list for PBXProject "engine" */;
@@ -235,6 +359,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = AD58E0461E107411006ACC15;
productRefGroup = AD58E0501E107411006ACC15 /* Products */;
@@ -242,10 +367,25 @@
projectRoot = "";
targets = (
AD58E04E1E107411006ACC15 /* engine */,
ADD7D26A1EBF9AE300D5A897 /* PanoPainter */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
ADD7D2691EBF9AE300D5A897 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AD5016591EBFC7F00079A826 /* data in Resources */,
ADD7D27C1EBF9AE300D5A897 /* Main.storyboard in Resources */,
ADD7D27E1EBF9AE300D5A897 /* Assets.xcassets in Resources */,
ADD7D2811EBF9AE300D5A897 /* LaunchScreen.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
AD58E04B1E107411006ACC15 /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -276,8 +416,59 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
ADD7D2671EBF9AE300D5A897 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
ADD7D2951EBF9E1C00D5A897 /* bezier.cpp in Sources */,
ADD7D29E1EBF9E1C00D5A897 /* shape.cpp in Sources */,
ADD7D2901EBF9E1C00D5A897 /* canvas_modes.cpp in Sources */,
ADD7D2A31EBFA06F00D5A897 /* tinyxml2.cpp in Sources */,
ADD7D29C1EBF9E1C00D5A897 /* shader.cpp in Sources */,
ADD7D2A51EBFA06F00D5A897 /* Yoga.c in Sources */,
ADD7D2921EBF9E1C00D5A897 /* action.cpp in Sources */,
ADD7D29A1EBF9E1C00D5A897 /* pch.cpp in Sources */,
ADD7D29D1EBF9E1C00D5A897 /* main.cpp in Sources */,
ADD7D29F1EBF9E1C00D5A897 /* app.cpp in Sources */,
ADD7D2941EBF9E1C00D5A897 /* asset.cpp in Sources */,
ADD7D29B1EBF9E1C00D5A897 /* layout.cpp in Sources */,
ADD7D2931EBF9E1C00D5A897 /* log.cpp in Sources */,
ADD7D2971EBF9E1C00D5A897 /* canvas.cpp in Sources */,
ADD7D2991EBF9E1C00D5A897 /* font.cpp in Sources */,
ADD7D2981EBF9E1C00D5A897 /* rtt.cpp in Sources */,
ADD7D2721EBF9AE300D5A897 /* AppDelegate.m in Sources */,
ADD7D2A21EBF9E1C00D5A897 /* util.cpp in Sources */,
ADD7D2791EBF9AE300D5A897 /* GameViewController.m in Sources */,
ADD7D26F1EBF9AE300D5A897 /* main.m in Sources */,
ADD7D2A01EBF9E1C00D5A897 /* image.cpp in Sources */,
ADD7D2A11EBF9E1C00D5A897 /* texture.cpp in Sources */,
ADD7D2961EBF9E1C00D5A897 /* brush.cpp in Sources */,
ADD7D2911EBF9E1C00D5A897 /* event.cpp in Sources */,
ADD7D2A41EBFA06F00D5A897 /* YGNodeList.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
ADD7D27A1EBF9AE300D5A897 /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
ADD7D27B1EBF9AE300D5A897 /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
ADD7D27F1EBF9AE300D5A897 /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
ADD7D2801EBF9AE300D5A897 /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
AD58E0541E107411006ACC15 /* Debug */ = {
isa = XCBuildConfiguration;
@@ -381,6 +572,7 @@
AD58E0571E107411006ACC15 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
@@ -388,10 +580,49 @@
AD58E0581E107411006ACC15 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
ADD7D2831EBF9AE300D5A897 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
INFOPLIST_FILE = PanoPainter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "/Users/omimac/Downloads/curl-android-ios-master/prebuilt-with-ssl/iOS";
PRODUCT_BUNDLE_IDENTIFIER = com.omixlab.PanoPainter;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
ADD7D2841EBF9AE300D5A897 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
INFOPLIST_FILE = PanoPainter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = "/Users/omimac/Downloads/curl-android-ios-master/prebuilt-with-ssl/iOS";
PRODUCT_BUNDLE_IDENTIFIER = com.omixlab.PanoPainter;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@@ -413,6 +644,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
ADD7D2851EBF9AE300D5A897 /* Build configuration list for PBXNativeTarget "PanoPainter" */ = {
isa = XCConfigurationList;
buildConfigurations = (
ADD7D2831EBF9AE300D5A897 /* Debug */,
ADD7D2841EBF9AE300D5A897 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = AD58E0471E107411006ACC15 /* Project object */;

View File

@@ -17,6 +17,11 @@
<key>primary</key>
<true/>
</dict>
<key>ADD7D26A1EBF9AE300D5A897</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -277,10 +277,10 @@ void App::initShaders()
"in mediump vec2 uv;\n"
"out mediump vec4 frag;\n"
"void main(){\n"
" const vec4 c1 = vec4(1.0, 1.0, 1.0, 1.0);\n"
" const vec4 c2 = vec4(0.9, 0.9, 0.9, 1.0);\n"
" vec2 c = floor(fract(uv * 10.0) * 2.0);\n"
" float alpha = mix(c.x, 1.0 - c.x, c.y);\n"
" const mediump vec4 c1 = vec4(1.0, 1.0, 1.0, 1.0);\n"
" const mediump vec4 c2 = vec4(0.9, 0.9, 0.9, 1.0);\n"
" mediump vec2 c = floor(fract(uv * 10.0) * 2.0);\n"
" mediump float alpha = mix(c.x, 1.0 - c.x, c.y);\n"
" frag = mix(c1, c2, alpha);\n"
"}";
@@ -302,11 +302,11 @@ void App::initShaders()
"in mediump vec2 uv;\n"
"out mediump vec4 frag;\n"
"void main(){\n"
" float anglex = uv.x;\n"
" float angley = uv.y;\n"
" float sx = sin(anglex);\n"
" float cx = cos(anglex);\n"
" vec3 dir = vec3(0.0, 0.0, 0.0);\n"
" mediump float anglex = uv.x;\n"
" mediump float angley = uv.y;\n"
" mediump float sx = sin(anglex);\n"
" mediump float cx = cos(anglex);\n"
" mediump vec3 dir = vec3(0.0, 0.0, 0.0);\n"
" dir.x = sin(angley) * cx;\n"
" dir.y = cos(angley);\n"
" dir.z = sin(angley) * sx;\n"

View File

@@ -2,14 +2,19 @@
#include "log.h"
#include "asset.h"
#ifdef __IOS__
#include <Foundation/Foundation.h>
#endif
#ifdef __ANDROID__
AAssetManager* Asset::m_am;
#endif
bool Asset::open(const char* path)
{
//LOG("Asset::open %s", path);
LOG("Asset::open %s", path);
m_current_path = path;
std::string file_path = path;
#ifdef __ANDROID__
if (!(m_asset = AAssetManager_open(m_am, path, AASSET_MODE_RANDOM)))
{
@@ -19,8 +24,16 @@ bool Asset::open(const char* path)
m_len = (int)AAsset_getLength(m_asset);
m_data = (uint8_t*)AAsset_getBuffer(m_asset);
#else
if (!(m_fp = fopen(path, "rb")))
#ifdef __IOS__
NSString* bundle_path = [[NSBundle mainBundle] bundlePath];
std::string base = [bundle_path cStringUsingEncoding:1];
file_path = base + "/" + path;
#endif
if (!(m_fp = fopen(file_path.c_str(), "rb")))
{
LOG("errno = %d", errno);
return false;
}
fseek(m_fp, 0, SEEK_END);
m_len = (int)ftell(m_fp);
fseek(m_fp, 0, SEEK_SET);

View File

@@ -540,7 +540,8 @@ bool LayoutManager::load(const char* path)
if (m_loaded)
return true; // already loaded
#ifndef __ANDROID__
/*
#if !defined(__ANDROID__)
struct stat tmp_info;
if (stat(path, &tmp_info) != 0)
return false;
@@ -548,6 +549,7 @@ bool LayoutManager::load(const char* path)
return false;
m_file_info = tmp_info;
#endif // __ANDROID__
*/
m_path = path;

View File

@@ -8,11 +8,12 @@
#include "keymap.h"
#ifdef __APPLE__
#ifdef TARGET_OS_OSX
#include <CoreFoundation/CoreFoundation.h>
#include <Cocoa/Cocoa.h>
#include <CoreVideo/CoreVideo.h>
#include <OpenGL/OpenGL.h>
@interface View : NSOpenGLView
{
CVDisplayLinkRef dl;
@@ -360,6 +361,7 @@ int main(int argc, const char * argv[])
return 0;
}
#endif
#endif
#ifdef _WIN32

View File

@@ -4,14 +4,28 @@
#define USE_SAMPLER 1
#ifdef __APPLE__
#include "TargetConditionals.h"
#if TARGET_OS_IPHONE && TARGET_IPHONE_SIMULATOR
#define TARGET_OS_IOS 1
#define __IOS__ 1
#include <CoreFoundation/CoreFoundation.h>
#include <OpenGLES/ES3/gl.h>
#include <OpenGLES/ES3/glext.h>
#define SHADER_VERSION "#version 300 es\n"
#elif TARGET_OS_IPHONE
// define something for iphone
#else
#define TARGET_OS_OSX 1
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>
#define SHADER_VERSION "#version 150\n"
#endif
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#define SHADER_VERSION "#version 150\n"
#elif __ANDROID__
#include <EGL/egl.h>
#include <EGL/eglext.h>
@@ -22,7 +36,7 @@
#include <android/log.h>
#include <android_native_app_glue.h>
#define SHADER_VERSION "#version 300 es\n"
#define SHADER_VERSION "#version 300 es\n"
#elif _WIN32
#define _USE_MATH_DEFINES