add support for Apple Pencil and build for iOS

This commit is contained in:
2017-07-28 20:35:59 +01:00
parent e32329ea98
commit 0907429a60
15 changed files with 236 additions and 35 deletions

View File

@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
@@ -30,6 +40,16 @@
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
@@ -61,9 +81,16 @@
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "icon512.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "icon1024.png",
"scale" : "1x"
}
],
"info" : {

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -1,8 +1,12 @@
<?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">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13156.6" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BV1-FR-VrT">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13137.5"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Game View Controller-->
@@ -14,9 +18,9 @@
<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"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="SZV-WD-TEh" sceneMemberID="firstResponder"/>

View File

@@ -9,6 +9,6 @@
#import <UIKit/UIKit.h>
#import <GLKit/GLKit.h>
@interface GameViewController : GLKViewController
@interface GameViewController : GLKViewController <UIKeyInput>
@end

View File

@@ -19,28 +19,98 @@
- (void)tearDownGL;
@end
//std::map<
int t_count = 0;
@implementation GameViewController
- (void)insertText:(NSString *)text
{
if (const char* cstr = [text cStringUsingEncoding:NSASCIIStringEncoding])
App::I.key_char(cstr[0]);
NSLog(@"%@", text);
// Do something with the typed character
}
- (void)deleteBackward {
App::I.key_char('\b');
// Handle the delete key
}
- (BOOL)hasText {
// Return whether there's any text present
return YES;
}
- (BOOL)canBecomeFirstResponder {
return YES;
}
- (void)touchesBegan:(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_down(0, touchLocation.x * scale, touchLocation.y * scale);
App::I.mouse_down(0, touchLocation.x * scale, touchLocation.y * scale, touch.force);
t_count = 1;
}
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
NSUInteger n = [[event allTouches] count];
float scale = self.view.contentScaleFactor;
App::I.mouse_move(touchLocation.x * scale, touchLocation.y * scale);
UITouch* t0 = nullptr;
UITouch* t1 = nullptr;
t0 = [[[event allTouches] allObjects] objectAtIndex:0];
CGPoint tl0 = [t0 locationInView:self.view];
glm::vec2 p0 = glm::vec2(tl0.x * scale, tl0.y * scale);
glm::vec2 p1;
if (n > 1)
{
t1 = [[[event allTouches] allObjects] objectAtIndex:1];
CGPoint tl1 = [t1 locationInView:self.view];
p1 = glm::vec2(tl1.x * scale, tl1.y * scale);
}
if (n == 2)
{
if (t_count == 1)
{
App::I.mouse_cancel(0);
App::I.gesture_start(p0, p1);
}
else
App::I.gesture_move(p0, p1);
t_count = 2;
}
else if (n == 1)
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchLocation = [touch locationInView:self.view];
//auto p = glm::vec2(touchLocation.x * scale, touchLocation.y * scale);
float force = touch.type == UITouchType::UITouchTypeStylus ? touch.force : 1.0f;
if (t_count == 2)
{
//App::I.gesture_end();
//App::I.mouse_down(0, touchLocation.x * scale, touchLocation.y * scale, force);
}
else
{
App::I.mouse_move(touchLocation.x * scale, touchLocation.y * scale, force);
}
}
}
-(void)touchesEnded:(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_up(0, touchLocation.x * scale, touchLocation.y * scale);
if (t_count == 2)
App::I.gesture_end();
else
App::I.mouse_up(0, touchLocation.x * scale, touchLocation.y * scale);
t_count = 0;
}
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
@@ -49,11 +119,16 @@
size.height * self.view.contentScaleFactor);
}
- (void)viewDidAppear:(BOOL)animated
{
[self resignFirstResponder];
}
- (void)viewDidLoad
{
[super viewDidLoad];
App::I.initLog();
App::I.ios_view = self;
self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3];

View File

@@ -150,6 +150,8 @@
AD58E0771E3421F2006ACC15 /* Yoga.c in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0751E3421F2006ACC15 /* Yoga.c */; };
AD58E0791E342205006ACC15 /* tinyxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD58E0781E342205006ACC15 /* tinyxml2.cpp */; };
AD744B6E1EBC9EF800B66E30 /* canvas_modes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD744B6C1EBC9EF700B66E30 /* canvas_modes.cpp */; };
AD759B681F2796EA00211963 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD759B671F2796EA00211963 /* OpenGLES.framework */; };
AD759B691F279B3900211963 /* GLKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD759B661F27964D00211963 /* GLKit.framework */; };
AD8CF7211E913F0500083FFD /* log.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD8CF71F1E913F0500083FFD /* log.cpp */; };
AD8CF7231E914DE400083FFD /* libcurl.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8CF7221E914DE400083FFD /* libcurl.tbd */; };
AD95AEC61E41EDEC002DD03A /* font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AD95AEC31E41EDEC002DD03A /* font.cpp */; };
@@ -163,10 +165,8 @@
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 */; };
@@ -210,7 +210,7 @@
/* Begin PBXFileReference section */
AD02F0C01EDC456800B2E692 /* sequencer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sequencer.cpp; sourceTree = "<group>"; };
AD02F0C11EDC456800B2E692 /* sequencer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sequencer.h; sourceTree = "<group>"; };
AD0E11921ECA20F200CDA6BB /* app_events.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = app_events.cpp; sourceTree = "<group>"; };
AD0E11921ECA20F200CDA6BB /* app_events.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp.preprocessed; fileEncoding = 4; path = app_events.cpp; sourceTree = "<group>"; };
AD0E11931ECA20F200CDA6BB /* app_layout.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = app_layout.cpp; sourceTree = "<group>"; };
AD0E11941ECA20F200CDA6BB /* app_shaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = app_shaders.cpp; sourceTree = "<group>"; };
AD0E11951ECA20F200CDA6BB /* node_scroll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_scroll.cpp; sourceTree = "<group>"; };
@@ -244,7 +244,7 @@
AD1063641EC7ADFA002A525F /* node_image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_image.h; sourceTree = "<group>"; };
AD1063651EC7ADFA002A525F /* node_message_box.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_message_box.cpp; sourceTree = "<group>"; };
AD1063661EC7ADFA002A525F /* node_message_box.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_message_box.h; sourceTree = "<group>"; };
AD1063671EC7ADFA002A525F /* node_panel_brush.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_panel_brush.cpp; sourceTree = "<group>"; };
AD1063671EC7ADFA002A525F /* node_panel_brush.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = node_panel_brush.cpp; sourceTree = "<group>"; };
AD1063681EC7ADFA002A525F /* node_panel_brush.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_panel_brush.h; sourceTree = "<group>"; };
AD1063691EC7ADFA002A525F /* node_panel_color.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = node_panel_color.cpp; sourceTree = "<group>"; };
AD10636A1EC7ADFA002A525F /* node_panel_color.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_panel_color.h; sourceTree = "<group>"; };
@@ -298,13 +298,16 @@
AD58E06C1E2A78BD006ACC15 /* pch.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = pch.h; sourceTree = "<group>"; };
AD58E06D1E2A80BC006ACC15 /* shape.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shape.cpp; sourceTree = "<group>"; };
AD58E06E1E2A80BC006ACC15 /* shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = shape.h; sourceTree = "<group>"; };
AD58E0701E2A90EF006ACC15 /* app.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = app.cpp; sourceTree = "<group>"; };
AD58E0701E2A90EF006ACC15 /* app.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = app.cpp; sourceTree = "<group>"; };
AD58E0711E2A90EF006ACC15 /* app.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = app.h; sourceTree = "<group>"; };
AD58E0741E3421F2006ACC15 /* YGNodeList.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = YGNodeList.c; path = libs/yoga/yoga/YGNodeList.c; sourceTree = "<group>"; };
AD58E0751E3421F2006ACC15 /* Yoga.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Yoga.c; path = libs/yoga/yoga/Yoga.c; sourceTree = "<group>"; };
AD58E0781E342205006ACC15 /* tinyxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tinyxml2.cpp; path = libs/tinyxml2/tinyxml2.cpp; sourceTree = "<group>"; };
AD744B6C1EBC9EF700B66E30 /* canvas_modes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = canvas_modes.cpp; sourceTree = "<group>"; };
AD744B6D1EBC9EF800B66E30 /* canvas_modes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = canvas_modes.h; sourceTree = "<group>"; };
AD759B641F2793AE00211963 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
AD759B661F27964D00211963 /* GLKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GLKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.0.sdk/System/Library/Frameworks/GLKit.framework; sourceTree = DEVELOPER_DIR; };
AD759B671F2796EA00211963 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; };
AD8CF71F1E913F0500083FFD /* log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = log.cpp; sourceTree = "<group>"; };
AD8CF7201E913F0500083FFD /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = "<group>"; };
AD8CF7221E914DE400083FFD /* libcurl.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libcurl.tbd; path = usr/lib/libcurl.tbd; sourceTree = SDKROOT; };
@@ -327,11 +330,10 @@
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>"; };
ADD7D2AE1EBFA35F00D5A897 /* libcurl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcurl.a; path = "../../Downloads/curl-android-ios-master/prebuilt-with-ssl/iOS/arm64/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 */
@@ -365,12 +367,12 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AD759B691F279B3900211963 /* GLKit.framework in Frameworks */,
ADD7D2B31EBFA42C00D5A897 /* Security.framework in Frameworks */,
ADD7D2B11EBFA42600D5A897 /* libz.tbd in Frameworks */,
ADD7D28F1EBF9D8C00D5A897 /* GLKit.framework in Frameworks */,
AD759B681F2796EA00211963 /* OpenGLES.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 */,
);
@@ -458,12 +460,12 @@
AD58E0461E107411006ACC15 = {
isa = PBXGroup;
children = (
AD759B671F2796EA00211963 /* OpenGLES.framework */,
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 */,
@@ -477,6 +479,7 @@
ADD7D26C1EBF9AE300D5A897 /* PanoPainter */,
AD0E5C9D1ECC6F2B00C35669 /* PanoPainter-OSX */,
AD58E0501E107411006ACC15 /* Products */,
AD759B631F2793AD00211963 /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -551,6 +554,15 @@
name = libs;
sourceTree = "<group>";
};
AD759B631F2793AD00211963 /* Frameworks */ = {
isa = PBXGroup;
children = (
AD759B661F27964D00211963 /* GLKit.framework */,
AD759B641F2793AE00211963 /* OpenGLES.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
ADD7D26C1EBF9AE300D5A897 /* PanoPainter */ = {
isa = PBXGroup;
children = (
@@ -643,9 +655,12 @@
};
AD58E04E1E107411006ACC15 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = A6Y3VHN7V9;
ProvisioningStyle = Automatic;
};
ADD7D26A1EBF9AE300D5A897 = {
CreatedOnToolsVersion = 7.2;
DevelopmentTeam = A6Y3VHN7V9;
};
};
};
@@ -936,6 +951,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -990,6 +1006,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD)";
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
@@ -1036,16 +1053,24 @@
AD58E0571E107411006ACC15 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = A6Y3VHN7V9;
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
};
name = Debug;
};
AD58E0581E107411006ACC15 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = A6Y3VHN7V9;
MACH_O_TYPE = mh_execute;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
};
name = Release;
};
@@ -1057,6 +1082,16 @@
CLANG_ENABLE_MODULES = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = A6Y3VHN7V9;
HEADER_SEARCH_PATHS = (
"/Users/omimac/Downloads/curl-android-ios-master/prebuilt-with-ssl/iOS/include",
libs/stb,
libs/glm,
libs/yoga,
libs/tinyxml2,
/opt/local/include,
libs/jpeg,
);
INFOPLIST_FILE = PanoPainter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
@@ -1075,6 +1110,16 @@
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_ENABLE_MODULES = NO;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = A6Y3VHN7V9;
HEADER_SEARCH_PATHS = (
"/Users/omimac/Downloads/curl-android-ios-master/prebuilt-with-ssl/iOS/include",
libs/stb,
libs/glm,
libs/yoga,
libs/tinyxml2,
/opt/local/include,
libs/jpeg,
);
INFOPLIST_FILE = PanoPainter/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";

View File

@@ -4,6 +4,10 @@
#include "node_icon.h"
#include "node_dialog_open.h"
#ifdef __APPLE__
#include <Foundation/Foundation.h>
#endif
using namespace ui;
App App::I; // singleton
@@ -84,7 +88,13 @@ void App::init()
LOG("Screen Resolution: %dx%d", (int)width, (int)height);
zoom = ceilf(width / 1000.f);
zoom = ceilf(width / 2000.f);
#ifdef __IOS__
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* docpath = [paths objectAtIndex:0];
data_path = [docpath cStringUsingEncoding:NSASCIIStringEncoding];
#endif
glDisable(GL_DEPTH_TEST);
#if defined(_WIN32) || defined(__OSX__)

View File

@@ -15,6 +15,11 @@
#include "node_panel_stroke.h"
#include "node_canvas.h"
#ifdef __OBJC__
#import <Foundation/Foundation.h>
#import "GameViewController.h"
#endif
class App
{
public:
@@ -51,6 +56,12 @@ public:
#else
float zoom = 1.0;
#endif // __ANDROID__
#if defined(__IOS__) && defined(__OBJC__)
GameViewController* ios_view;
#endif
void showKeyboard();
void hideKeyboard();
void initLog();
void init();
void initShaders();

View File

@@ -11,6 +11,20 @@ void App::resize(float w, float h)
main->update(w , h, zoom);
}
void App::showKeyboard()
{
#ifdef __IOS__
[ios_view becomeFirstResponder];
#endif
}
void App::hideKeyboard()
{
#ifdef __IOS__
[ios_view resignFirstResponder];
#endif
}
bool App::mouse_down(int button, float x, float y, float pressure)
{
MouseEvent e;

View File

@@ -16,7 +16,7 @@ bool Font::load(const char* ttf, int font_size)
LOG("Font::load loaded");
auto bitmap = std::make_unique<uint8_t[]>(w*h);
chars.resize(num_chars);
stbtt_BakeFontBitmap(file.m_data, 0, (float)font_size, bitmap.get(), w, h, start_char, num_chars, chars.data());
stbtt_BakeFontBitmap(file.m_data, 0, (float)font_size*2, bitmap.get(), w, h, start_char, num_chars, chars.data());
font_tex.create(w, h, GL_R8, GL_RED, bitmap.get());
file.close();
return true;
@@ -75,18 +75,18 @@ void TextMesh::update(kFont id, const char* text)
stbtt_aligned_quad q;
stbtt_GetBakedQuad((stbtt_bakedchar*)f.chars.data(), f.w, f.h, c, &x, &y, &q, true);
auto n = (int)v.size();
v.emplace_back(q.x0, q.y1, q.s0, q.t1);
v.emplace_back(q.x0, q.y0, q.s0, q.t0);
v.emplace_back(q.x1, q.y0, q.s1, q.t0);
v.emplace_back(q.x1, q.y1, q.s1, q.t1);
v.emplace_back(q.x0/2.f, q.y1/2.f, q.s0, q.t1);
v.emplace_back(q.x0/2.f, q.y0/2.f, q.s0, q.t0);
v.emplace_back(q.x1/2.f, q.y0/2.f, q.s1, q.t0);
v.emplace_back(q.x1/2.f, q.y1/2.f, q.s1, q.t1);
idx.push_back(n+0);
idx.push_back(n+1);
idx.push_back(n+2);
idx.push_back(n+0);
idx.push_back(n+2);
idx.push_back(n+3);
bbmin = glm::min(bbmin, { q.x0, q.y0 });
bbmax = glm::max(bbmax, { q.x1, q.y1 });
bbmin = glm::min(bbmin, { q.x0/2.f, q.y0/2.f });
bbmax = glm::max(bbmax, { q.x1/2.f, q.y1/2.f });
}
for (int i = 0; i < len*4; i++)
{

View File

@@ -11,7 +11,7 @@ void NodeCanvas::init()
{
m_mouse_ignore = false;
m_canvas = std::make_unique<ui::Canvas>();
m_canvas->create(2048, 2048);
m_canvas->create(512, 512);
m_sampler.create(GL_NEAREST);
m_face_plane.create<1>(2, 2);
m_line.create();
@@ -25,7 +25,7 @@ void NodeCanvas::init()
void NodeCanvas::restore_context()
{
Node::restore_context();
m_canvas->create(2048, 2048);
m_canvas->create(512, 512);
m_sampler.create(GL_NEAREST);
m_face_plane.create<1>(2, 2);
m_canvas->snapshot_restore();

View File

@@ -3,6 +3,10 @@
#include "node_panel_brush.h"
#include "asset.h"
#ifdef __APPLE__
#include <Foundation/Foundation.h>
#endif
Node* NodeButtonBrush::clone_instantiate() const
{
return new NodeButtonBrush();
@@ -99,9 +103,13 @@ std::vector<std::string> NodePanelBrush::FindAllBrushes(std::string folder)
}
AAssetDir_close(dir);
#else
NSString* bundle_path = [[NSBundle mainBundle] resourcePath];
std::string base = [bundle_path cStringUsingEncoding:1];
std::string abs_path = base + "/" + folder;
DIR *dp;
struct dirent *ep;
dp = opendir(folder.c_str());
dp = opendir(abs_path.c_str());
if (dp != NULL)
{

View File

@@ -1,4 +1,5 @@
#include "pch.h"
#include "app.h"
#include "log.h"
#include "node_text_input.h"
@@ -41,6 +42,7 @@ kEventResult NodeTextInput::handle_event(Event* e)
switch (e->m_type)
{
case kEventType::MouseDownL:
App::I.showKeyboard();
break;
case kEventType::MouseUpL:
key_capture();

View File

@@ -14,7 +14,12 @@
#include <OpenGLES/ES3/glext.h>
#define SHADER_VERSION "#version 300 es\n"
#elif TARGET_OS_IPHONE
// define something for iphone
#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"
#else
#define TARGET_OS_OSX 1
#define __OSX__ 1