Update the code for the iOS demos to handle modern devices. Fixes bug #3337
authorAlex Szpakowski <slime73@gmail.com>
Sun, 25 Sep 2016 00:23:35 -0300
changeset 10370d90965a3b100
parent 10369 001cbf1fda90
child 10371 155d4f094f62
Update the code for the iOS demos to handle modern devices. Fixes bug #3337
Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj
Xcode-iOS/Demos/Info.plist
Xcode-iOS/Demos/iOS Launch Screen.storyboard
Xcode-iOS/Demos/src/accelerometer.c
Xcode-iOS/Demos/src/common.c
Xcode-iOS/Demos/src/common.h
Xcode-iOS/Demos/src/fireworks.c
Xcode-iOS/Demos/src/happy.c
Xcode-iOS/Demos/src/keyboard.c
Xcode-iOS/Demos/src/mixer.c
Xcode-iOS/Demos/src/rectangles.c
Xcode-iOS/Demos/src/touch.c
     1.1 --- a/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj	Sun Sep 25 00:21:12 2016 -0300
     1.2 +++ b/Xcode-iOS/Demos/Demos.xcodeproj/project.pbxproj	Sun Sep 25 00:23:35 2016 -0300
     1.3 @@ -24,6 +24,13 @@
     1.4  		FA30DECD1BBF5C14009C397F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
     1.5  		FA30DECE1BBF5C14009C397F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
     1.6  		FA30DECF1BBF5C14009C397F /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDF0D71D0E12D2AB00247964 /* CoreAudio.framework */; };
     1.7 +		FA86C0371D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; };
     1.8 +		FA86C0381D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; };
     1.9 +		FA86C0391D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; };
    1.10 +		FA86C03A1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; };
    1.11 +		FA86C03B1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; };
    1.12 +		FA86C03C1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; };
    1.13 +		FA86C03D1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */; };
    1.14  		FA8B4BA31967070A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
    1.15  		FA8B4BA41967071300F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
    1.16  		FA8B4BA51967071A00F8EB7C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */; };
    1.17 @@ -220,6 +227,7 @@
    1.18  		1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
    1.19  		8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
    1.20  		FA30DE961BBF59D9009C397F /* Happy-TV.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Happy-TV.app"; sourceTree = BUILT_PRODUCTS_DIR; };
    1.21 +		FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "iOS Launch Screen.storyboard"; sourceTree = "<group>"; };
    1.22  		FA8B4BA21967070A00F8EB7C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; };
    1.23  		FABA34D31D8B5E5600915323 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
    1.24  		FABA34D71D8B5E7700915323 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS10.0.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
    1.25 @@ -423,6 +431,7 @@
    1.26  		29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
    1.27  			isa = PBXGroup;
    1.28  			children = (
    1.29 +				FA86C0361D9765BA009CB637 /* iOS Launch Screen.storyboard */,
    1.30  				FD1B48920E313154007AB34E /* SDL.xcodeproj */,
    1.31  				FD77A0040E26BC0500F39101 /* src */,
    1.32  				29B97317FDCFA39411CA2CEA /* Resources */,
    1.33 @@ -676,7 +685,9 @@
    1.34  				TargetAttributes = {
    1.35  					FA30DE951BBF59D9009C397F = {
    1.36  						CreatedOnToolsVersion = 7.1;
    1.37 -						DevelopmentTeam = DJN9C5VR5G;
    1.38 +					};
    1.39 +					FDC52EC60E2843D6008D768C = {
    1.40 +						ProvisioningStyle = Automatic;
    1.41  					};
    1.42  				};
    1.43  			};
    1.44 @@ -735,6 +746,7 @@
    1.45  			isa = PBXResourcesBuildPhase;
    1.46  			buildActionMask = 2147483647;
    1.47  			files = (
    1.48 +				FA86C0371D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */,
    1.49  				FD925B1B0E0F276600E92347 /* Icon.png in Resources */,
    1.50  				FD787AA20E22A5CC003E8E36 /* Default.png in Resources */,
    1.51  			);
    1.52 @@ -755,6 +767,7 @@
    1.53  			buildActionMask = 2147483647;
    1.54  			files = (
    1.55  				FDB651D00E43D1AD00F688B5 /* icon.bmp in Resources */,
    1.56 +				FA86C0381D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */,
    1.57  				FD925B1A0E0F276600E92347 /* Icon.png in Resources */,
    1.58  				FD787AA10E22A5CC003E8E36 /* Default.png in Resources */,
    1.59  			);
    1.60 @@ -768,6 +781,7 @@
    1.61  				FDB651D10E43D1B300F688B5 /* ship.bmp in Resources */,
    1.62  				FD925B190E0F276600E92347 /* Icon.png in Resources */,
    1.63  				FD787AA30E22A5CC003E8E36 /* Default.png in Resources */,
    1.64 +				FA86C0391D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */,
    1.65  			);
    1.66  			runOnlyForDeploymentPostprocessing = 0;
    1.67  		};
    1.68 @@ -779,6 +793,7 @@
    1.69  				FDB651FA0E43D1F300F688B5 /* Icon.png in Resources */,
    1.70  				FDB651FB0E43D1F300F688B5 /* Default.png in Resources */,
    1.71  				FDB652C70E43E25900F688B5 /* kromasky_16x16.bmp in Resources */,
    1.72 +				FA86C03D1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */,
    1.73  			);
    1.74  			runOnlyForDeploymentPostprocessing = 0;
    1.75  		};
    1.76 @@ -787,6 +802,7 @@
    1.77  			buildActionMask = 2147483647;
    1.78  			files = (
    1.79  				FDB651D30E43D1BA00F688B5 /* stroke.bmp in Resources */,
    1.80 +				FA86C03A1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */,
    1.81  				FDC202E10E107B1200ABAC90 /* Icon.png in Resources */,
    1.82  				FD787AA40E22A5CC003E8E36 /* Default.png in Resources */,
    1.83  			);
    1.84 @@ -797,6 +813,7 @@
    1.85  			buildActionMask = 2147483647;
    1.86  			files = (
    1.87  				FDB651D80E43D1D800F688B5 /* stroke.bmp in Resources */,
    1.88 +				FA86C03C1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */,
    1.89  				FDC52EC80E2843D6008D768C /* Icon.png in Resources */,
    1.90  				FDC52EC90E2843D6008D768C /* Default.png in Resources */,
    1.91  			);
    1.92 @@ -809,6 +826,7 @@
    1.93  				FDB651D40E43D1C500F688B5 /* ds_brush_snare.wav in Resources */,
    1.94  				FDB651D50E43D1C500F688B5 /* ds_china.wav in Resources */,
    1.95  				FDB651D60E43D1C500F688B5 /* ds_kick_big_amb.wav in Resources */,
    1.96 +				FA86C03B1D9765BB009CB637 /* iOS Launch Screen.storyboard in Resources */,
    1.97  				FDB651D70E43D1C500F688B5 /* ds_loose_skin_mute.wav in Resources */,
    1.98  				FDF0D6960E12D05400247964 /* Icon.png in Resources */,
    1.99  				FD787AA50E22A5CC003E8E36 /* Default.png in Resources */,
   1.100 @@ -940,6 +958,7 @@
   1.101  			isa = XCBuildConfiguration;
   1.102  			buildSettings = {
   1.103  				INFOPLIST_FILE = Info.plist;
   1.104 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Rectangles;
   1.105  				PRODUCT_NAME = Rectangles;
   1.106  			};
   1.107  			name = Debug;
   1.108 @@ -948,6 +967,7 @@
   1.109  			isa = XCBuildConfiguration;
   1.110  			buildSettings = {
   1.111  				INFOPLIST_FILE = Info.plist;
   1.112 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Rectangles;
   1.113  				PRODUCT_NAME = Rectangles;
   1.114  			};
   1.115  			name = Release;
   1.116 @@ -995,6 +1015,7 @@
   1.117  				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
   1.118  				COPY_PHASE_STRIP = NO;
   1.119  				DEBUG_INFORMATION_FORMAT = dwarf;
   1.120 +				DEVELOPMENT_TEAM = "";
   1.121  				ENABLE_STRICT_OBJC_MSGSEND = YES;
   1.122  				ENABLE_TESTABILITY = YES;
   1.123  				GCC_C_LANGUAGE_STANDARD = gnu99;
   1.124 @@ -1013,7 +1034,7 @@
   1.125  				INFOPLIST_FILE = Info.plist;
   1.126  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
   1.127  				MTL_ENABLE_DEBUG_INFO = YES;
   1.128 -				PRODUCT_BUNDLE_IDENTIFIER = "com.Happy-TV";
   1.129 +				PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.Happy-TV";
   1.130  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.131  				SDKROOT = appletvos;
   1.132  				TARGETED_DEVICE_FAMILY = 3;
   1.133 @@ -1040,6 +1061,7 @@
   1.134  				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
   1.135  				COPY_PHASE_STRIP = NO;
   1.136  				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
   1.137 +				DEVELOPMENT_TEAM = "";
   1.138  				ENABLE_NS_ASSERTIONS = NO;
   1.139  				ENABLE_STRICT_OBJC_MSGSEND = YES;
   1.140  				GCC_C_LANGUAGE_STANDARD = gnu99;
   1.141 @@ -1053,7 +1075,7 @@
   1.142  				INFOPLIST_FILE = Info.plist;
   1.143  				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
   1.144  				MTL_ENABLE_DEBUG_INFO = NO;
   1.145 -				PRODUCT_BUNDLE_IDENTIFIER = "com.Happy-TV";
   1.146 +				PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.Happy-TV";
   1.147  				PRODUCT_NAME = "$(TARGET_NAME)";
   1.148  				SDKROOT = appletvos;
   1.149  				TARGETED_DEVICE_FAMILY = 3;
   1.150 @@ -1067,6 +1089,7 @@
   1.151  			buildSettings = {
   1.152  				GCC_DYNAMIC_NO_PIC = NO;
   1.153  				INFOPLIST_FILE = Info.plist;
   1.154 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Happy;
   1.155  				PRODUCT_NAME = Happy;
   1.156  				SDKROOT = iphoneos;
   1.157  			};
   1.158 @@ -1076,6 +1099,7 @@
   1.159  			isa = XCBuildConfiguration;
   1.160  			buildSettings = {
   1.161  				INFOPLIST_FILE = Info.plist;
   1.162 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Happy;
   1.163  				PRODUCT_NAME = Happy;
   1.164  				SDKROOT = iphoneos;
   1.165  			};
   1.166 @@ -1085,6 +1109,7 @@
   1.167  			isa = XCBuildConfiguration;
   1.168  			buildSettings = {
   1.169  				INFOPLIST_FILE = Info.plist;
   1.170 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Accel;
   1.171  				PRODUCT_NAME = Accel;
   1.172  				SDKROOT = iphoneos;
   1.173  			};
   1.174 @@ -1094,6 +1119,7 @@
   1.175  			isa = XCBuildConfiguration;
   1.176  			buildSettings = {
   1.177  				INFOPLIST_FILE = Info.plist;
   1.178 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Accel;
   1.179  				PRODUCT_NAME = Accel;
   1.180  				SDKROOT = iphoneos;
   1.181  			};
   1.182 @@ -1103,6 +1129,7 @@
   1.183  			isa = XCBuildConfiguration;
   1.184  			buildSettings = {
   1.185  				INFOPLIST_FILE = Info.plist;
   1.186 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Keyboard;
   1.187  				PRODUCT_NAME = Keyboard;
   1.188  				SDKROOT = iphoneos;
   1.189  			};
   1.190 @@ -1112,6 +1139,7 @@
   1.191  			isa = XCBuildConfiguration;
   1.192  			buildSettings = {
   1.193  				INFOPLIST_FILE = Info.plist;
   1.194 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Keyboard;
   1.195  				PRODUCT_NAME = Keyboard;
   1.196  				SDKROOT = iphoneos;
   1.197  			};
   1.198 @@ -1121,6 +1149,7 @@
   1.199  			isa = XCBuildConfiguration;
   1.200  			buildSettings = {
   1.201  				INFOPLIST_FILE = Info.plist;
   1.202 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Touch;
   1.203  				PRODUCT_NAME = Touch;
   1.204  				SDKROOT = iphoneos;
   1.205  			};
   1.206 @@ -1130,6 +1159,7 @@
   1.207  			isa = XCBuildConfiguration;
   1.208  			buildSettings = {
   1.209  				INFOPLIST_FILE = Info.plist;
   1.210 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Touch;
   1.211  				PRODUCT_NAME = Touch;
   1.212  				SDKROOT = iphoneos;
   1.213  			};
   1.214 @@ -1138,7 +1168,10 @@
   1.215  		FDC52EDC0E2843D6008D768C /* Debug */ = {
   1.216  			isa = XCBuildConfiguration;
   1.217  			buildSettings = {
   1.218 +				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
   1.219 +				DEVELOPMENT_TEAM = "";
   1.220  				INFOPLIST_FILE = Info.plist;
   1.221 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Fireworks;
   1.222  				PRODUCT_NAME = Fireworks;
   1.223  				SDKROOT = iphoneos;
   1.224  			};
   1.225 @@ -1147,7 +1180,10 @@
   1.226  		FDC52EDD0E2843D6008D768C /* Release */ = {
   1.227  			isa = XCBuildConfiguration;
   1.228  			buildSettings = {
   1.229 +				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
   1.230 +				DEVELOPMENT_TEAM = "";
   1.231  				INFOPLIST_FILE = Info.plist;
   1.232 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Fireworks;
   1.233  				PRODUCT_NAME = Fireworks;
   1.234  				SDKROOT = iphoneos;
   1.235  			};
   1.236 @@ -1157,6 +1193,7 @@
   1.237  			isa = XCBuildConfiguration;
   1.238  			buildSettings = {
   1.239  				INFOPLIST_FILE = Info.plist;
   1.240 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Mixer;
   1.241  				PRODUCT_NAME = Mixer;
   1.242  				SDKROOT = iphoneos;
   1.243  			};
   1.244 @@ -1166,6 +1203,7 @@
   1.245  			isa = XCBuildConfiguration;
   1.246  			buildSettings = {
   1.247  				INFOPLIST_FILE = Info.plist;
   1.248 +				PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.Mixer;
   1.249  				PRODUCT_NAME = Mixer;
   1.250  				SDKROOT = iphoneos;
   1.251  			};
     2.1 --- a/Xcode-iOS/Demos/Info.plist	Sun Sep 25 00:21:12 2016 -0300
     2.2 +++ b/Xcode-iOS/Demos/Info.plist	Sun Sep 25 00:23:35 2016 -0300
     2.3 @@ -11,7 +11,7 @@
     2.4  	<key>CFBundleIconFile</key>
     2.5  	<string></string>
     2.6  	<key>CFBundleIdentifier</key>
     2.7 -	<string>com.yourcompany.${PRODUCT_NAME:identifier}</string>
     2.8 +	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
     2.9  	<key>CFBundleInfoDictionaryVersion</key>
    2.10  	<string>6.0</string>
    2.11  	<key>CFBundleName</key>
    2.12 @@ -24,6 +24,8 @@
    2.13  	<string>1.0</string>
    2.14  	<key>NSMainNibFile</key>
    2.15  	<string></string>
    2.16 +	<key>UILaunchStoryboardName</key>
    2.17 +	<string>iOS Launch Screen</string>
    2.18  	<key>UISupportedInterfaceOrientations</key>
    2.19  	<array/>
    2.20  </dict>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Xcode-iOS/Demos/iOS Launch Screen.storyboard	Sun Sep 25 00:23:35 2016 -0300
     3.3 @@ -0,0 +1,40 @@
     3.4 +<?xml version="1.0" encoding="UTF-8"?>
     3.5 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
     3.6 +    <dependencies>
     3.7 +        <deployment identifier="iOS"/>
     3.8 +        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
     3.9 +        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    3.10 +    </dependencies>
    3.11 +    <scenes>
    3.12 +        <!--View Controller-->
    3.13 +        <scene sceneID="EHf-IW-A2E">
    3.14 +            <objects>
    3.15 +                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
    3.16 +                    <layoutGuides>
    3.17 +                        <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
    3.18 +                        <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
    3.19 +                    </layoutGuides>
    3.20 +                    <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
    3.21 +                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
    3.22 +                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
    3.23 +                        <subviews>
    3.24 +                            <imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Default.png" translatesAutoresizingMaskIntoConstraints="NO" id="VeL-6u-rS3"/>
    3.25 +                        </subviews>
    3.26 +                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
    3.27 +                        <constraints>
    3.28 +                            <constraint firstItem="VeL-6u-rS3" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="C5X-Vg-tvO"/>
    3.29 +                            <constraint firstAttribute="trailing" secondItem="VeL-6u-rS3" secondAttribute="trailing" id="X4i-1U-3JE"/>
    3.30 +                            <constraint firstItem="VeL-6u-rS3" firstAttribute="bottom" secondItem="xb3-aO-Qok" secondAttribute="top" id="dSu-2l-DcF"/>
    3.31 +                            <constraint firstItem="VeL-6u-rS3" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="xKC-uj-bxE"/>
    3.32 +                        </constraints>
    3.33 +                    </view>
    3.34 +                </viewController>
    3.35 +                <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
    3.36 +            </objects>
    3.37 +            <point key="canvasLocation" x="52" y="374.66266866566718"/>
    3.38 +        </scene>
    3.39 +    </scenes>
    3.40 +    <resources>
    3.41 +        <image name="Default.png" width="320" height="480"/>
    3.42 +    </resources>
    3.43 +</document>
     4.1 --- a/Xcode-iOS/Demos/src/accelerometer.c	Sun Sep 25 00:21:12 2016 -0300
     4.2 +++ b/Xcode-iOS/Demos/src/accelerometer.c	Sun Sep 25 00:23:35 2016 -0300
     4.3 @@ -8,7 +8,6 @@
     4.4  #include "math.h"
     4.5  #include "common.h"
     4.6  
     4.7 -#define MILLESECONDS_PER_FRAME 16       /* about 60 frames per second */
     4.8  #define DAMPING 0.5f;           /* after bouncing off a wall, damping coefficient determines final speed */
     4.9  #define FRICTION 0.0008f        /* coefficient of acceleration that opposes direction of motion */
    4.10  #define GRAVITY_CONSTANT 0.004f /* how sensitive the ship is to the accelerometer */
    4.11 @@ -31,9 +30,9 @@
    4.12  static SDL_Texture *space = 0;       /* texture for space (background */
    4.13  
    4.14  void
    4.15 -render(SDL_Renderer *renderer, int w, int h)
    4.16 +render(SDL_Renderer *renderer, int w, int h, double deltaTime)
    4.17  {
    4.18 -
    4.19 +    double deltaMilliseconds = deltaTime * 1000;
    4.20      float speed;
    4.21  
    4.22      /* get joystick (accelerometer) axis values and normalize them */
    4.23 @@ -54,10 +53,10 @@
    4.24       */
    4.25      shipData.vx +=
    4.26          ax * SDL_IPHONE_MAX_GFORCE / SINT16_MAX * GRAVITY_CONSTANT *
    4.27 -        MILLESECONDS_PER_FRAME;
    4.28 +        deltaMilliseconds;
    4.29      shipData.vy +=
    4.30          ay * SDL_IPHONE_MAX_GFORCE / SINT16_MAX * GRAVITY_CONSTANT *
    4.31 -        MILLESECONDS_PER_FRAME;
    4.32 +        deltaMilliseconds;
    4.33  
    4.34      speed = sqrt(shipData.vx * shipData.vx + shipData.vy * shipData.vy);
    4.35  
    4.36 @@ -67,10 +66,10 @@
    4.37          float diry = shipData.vy / speed;   /* normalized y velocity */
    4.38  
    4.39          /* update velocity due to friction */
    4.40 -        if (speed - FRICTION * MILLESECONDS_PER_FRAME > 0) {
    4.41 +        if (speed - FRICTION * deltaMilliseconds > 0) {
    4.42              /* apply friction */
    4.43 -            shipData.vx -= dirx * FRICTION * MILLESECONDS_PER_FRAME;
    4.44 -            shipData.vy -= diry * FRICTION * MILLESECONDS_PER_FRAME;
    4.45 +            shipData.vx -= dirx * FRICTION * deltaMilliseconds;
    4.46 +            shipData.vy -= diry * FRICTION * deltaMilliseconds;
    4.47          } else {
    4.48              /* applying friction would MORE than stop the ship, so just stop the ship */
    4.49              shipData.vx = 0.0f;
    4.50 @@ -79,8 +78,8 @@
    4.51      }
    4.52  
    4.53      /* update ship location */
    4.54 -    shipData.x += shipData.vx * MILLESECONDS_PER_FRAME;
    4.55 -    shipData.y += shipData.vy * MILLESECONDS_PER_FRAME;
    4.56 +    shipData.x += shipData.vx * deltaMilliseconds;
    4.57 +    shipData.y += shipData.vy * deltaMilliseconds;
    4.58  
    4.59      if (shipData.x > maxx) {
    4.60          shipData.x = maxx;
    4.61 @@ -161,9 +160,6 @@
    4.62  
    4.63      SDL_Window *window;         /* main window */
    4.64      SDL_Renderer *renderer;
    4.65 -    Uint32 startFrame;          /* time frame began to process */
    4.66 -    Uint32 endFrame;            /* time frame ended processing */
    4.67 -    Sint32 delay;               /* time to pause waiting to draw next frame */
    4.68      int done;                   /* should we clean up and exit? */
    4.69      int w, h;
    4.70  
    4.71 @@ -173,12 +169,11 @@
    4.72      }
    4.73  
    4.74      /* create main window and renderer */
    4.75 -    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    4.76 -                                SDL_WINDOW_OPENGL |
    4.77 -                                SDL_WINDOW_FULLSCREEN);
    4.78 +    window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
    4.79      renderer = SDL_CreateRenderer(window, 0, 0);
    4.80      
    4.81      SDL_GetWindowSize(window, &w, &h);
    4.82 +    SDL_RenderSetLogicalSize(renderer, w, h);
    4.83  
    4.84      /* print out some info about joysticks and try to open accelerometer for use */
    4.85      printf("There are %d joysticks available\n", SDL_NumJoysticks());
    4.86 @@ -208,24 +203,15 @@
    4.87      done = 0;
    4.88      /* enter main loop */
    4.89      while (!done) {
    4.90 +        double deltaTime = updateDeltaTime();
    4.91          SDL_Event event;
    4.92 -        startFrame = SDL_GetTicks();
    4.93          while (SDL_PollEvent(&event)) {
    4.94              if (event.type == SDL_QUIT) {
    4.95                  done = 1;
    4.96              }
    4.97          }
    4.98 -        render(renderer, w, h);
    4.99 -        endFrame = SDL_GetTicks();
   4.100 -
   4.101 -        /* figure out how much time we have left, and then sleep */
   4.102 -        delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame);
   4.103 -        if (delay < 0) {
   4.104 -            delay = 0;
   4.105 -        } else if (delay > MILLESECONDS_PER_FRAME) {
   4.106 -            delay = MILLESECONDS_PER_FRAME;
   4.107 -        }
   4.108 -        SDL_Delay(delay);
   4.109 +        render(renderer, w, h, deltaTime);
   4.110 +        SDL_Delay(1);
   4.111      }
   4.112  
   4.113      /* delete textures */
     5.1 --- a/Xcode-iOS/Demos/src/common.c	Sun Sep 25 00:21:12 2016 -0300
     5.2 +++ b/Xcode-iOS/Demos/src/common.c	Sun Sep 25 00:23:35 2016 -0300
     5.3 @@ -32,5 +32,25 @@
     5.4  fatalError(const char *string)
     5.5  {
     5.6      printf("%s: %s\n", string, SDL_GetError());
     5.7 +    SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, string, SDL_GetError(), NULL);
     5.8      exit(1);
     5.9  }
    5.10 +
    5.11 +static Uint64 prevTime = 0;
    5.12 +
    5.13 +double
    5.14 +updateDeltaTime()
    5.15 +{
    5.16 +    Uint64 curTime;
    5.17 +    double deltaTime;
    5.18 +
    5.19 +    if (prevTime == 0) {
    5.20 +        prevTime = SDL_GetPerformanceCounter();
    5.21 +    }
    5.22 +
    5.23 +    curTime = SDL_GetPerformanceCounter();
    5.24 +    deltaTime = (double) (curTime - prevTime) / (double) SDL_GetPerformanceFrequency();
    5.25 +    prevTime = curTime;
    5.26 +
    5.27 +    return deltaTime;
    5.28 +}
     6.1 --- a/Xcode-iOS/Demos/src/common.h	Sun Sep 25 00:21:12 2016 -0300
     6.2 +++ b/Xcode-iOS/Demos/src/common.h	Sun Sep 25 00:23:35 2016 -0300
     6.3 @@ -4,14 +4,7 @@
     6.4   *  use however you want
     6.5   */
     6.6  
     6.7 -#if __TVOS__
     6.8 -#define SCREEN_WIDTH 1920
     6.9 -#define SCREEN_HEIGHT 1080
    6.10 -#else
    6.11 -#define SCREEN_WIDTH 320
    6.12 -#define SCREEN_HEIGHT 480
    6.13 -#endif
    6.14 -
    6.15  extern int randomInt(int min, int max);
    6.16  extern float randomFloat(float min, float max);
    6.17  extern void fatalError(const char *string);
    6.18 +extern double updateDeltaTime();
     7.1 --- a/Xcode-iOS/Demos/src/fireworks.c	Sun Sep 25 00:21:12 2016 -0300
     7.2 +++ b/Xcode-iOS/Demos/src/fireworks.c	Sun Sep 25 00:23:35 2016 -0300
     7.3 @@ -10,13 +10,13 @@
     7.4  #include <math.h>
     7.5  #include <time.h>
     7.6  
     7.7 -#define MILLESECONDS_PER_FRAME 16       /* about 60 frames per second */
     7.8  #define ACCEL 0.0001f           /* acceleration due to gravity, units in pixels per millesecond squared */
     7.9  #define WIND_RESISTANCE 0.00005f        /* acceleration per unit velocity due to wind resistance */
    7.10  #define MAX_PARTICLES 2000      /* maximum number of particles displayed at once */
    7.11  
    7.12  static GLuint particleTextureID;        /* OpenGL particle texture id */
    7.13  static SDL_bool pointSizeExtensionSupported;    /* is GL_OES_point_size_array supported ? */
    7.14 +static float pointSizeScale;
    7.15  /*
    7.16      used to describe what type of particle a given struct particle is.
    7.17      emitter - this particle flies up, shooting off trail particles, then finally explodes into dust particles.
    7.18 @@ -55,7 +55,7 @@
    7.19  void initializeTexture();
    7.20  int nextPowerOfTwo(int x);
    7.21  void drawParticles();
    7.22 -void stepParticles(void);
    7.23 +void stepParticles(double deltaTime);
    7.24  
    7.25  /*  helper function (used in texture loading)
    7.26      returns next power of two greater than or equal to x
    7.27 @@ -74,8 +74,9 @@
    7.28      steps each active particle by timestep MILLESECONDS_PER_FRAME
    7.29  */
    7.30  void
    7.31 -stepParticles(void)
    7.32 +stepParticles(double deltaTime)
    7.33  {
    7.34 +    float deltaMilliseconds = deltaTime * 1000;
    7.35      int i;
    7.36      struct particle *slot = particles;
    7.37      struct particle *curr = particles;
    7.38 @@ -93,10 +94,10 @@
    7.39                  curr->isActive = 0;
    7.40  
    7.41              /* step velocity, then step position */
    7.42 -            curr->yvel += ACCEL * MILLESECONDS_PER_FRAME;
    7.43 +            curr->yvel += ACCEL * deltaMilliseconds;
    7.44              curr->xvel += 0.0f;
    7.45 -            curr->y += curr->yvel * MILLESECONDS_PER_FRAME;
    7.46 -            curr->x += curr->xvel * MILLESECONDS_PER_FRAME;
    7.47 +            curr->y += curr->yvel * deltaMilliseconds;
    7.48 +            curr->x += curr->xvel * deltaMilliseconds;
    7.49  
    7.50              /* particle behavior */
    7.51              if (curr->type == emitter) {
    7.52 @@ -111,29 +112,29 @@
    7.53                      sqrt(curr->xvel * curr->xvel + curr->yvel * curr->yvel);
    7.54                  /*      if wind resistance is not powerful enough to stop us completely,
    7.55                     then apply winde resistance, otherwise just stop us completely */
    7.56 -                if (WIND_RESISTANCE * MILLESECONDS_PER_FRAME < speed) {
    7.57 +                if (WIND_RESISTANCE * deltaMilliseconds < speed) {
    7.58                      float normx = curr->xvel / speed;
    7.59                      float normy = curr->yvel / speed;
    7.60                      curr->xvel -=
    7.61 -                        normx * WIND_RESISTANCE * MILLESECONDS_PER_FRAME;
    7.62 +                        normx * WIND_RESISTANCE * deltaMilliseconds;
    7.63                      curr->yvel -=
    7.64 -                        normy * WIND_RESISTANCE * MILLESECONDS_PER_FRAME;
    7.65 +                        normy * WIND_RESISTANCE * deltaMilliseconds;
    7.66                  } else {
    7.67                      curr->xvel = curr->yvel = 0;        /* stop particle */
    7.68                  }
    7.69  
    7.70 -                if (curr->color[3] <= MILLESECONDS_PER_FRAME * 0.1275f) {
    7.71 +                if (curr->color[3] <= deltaMilliseconds * 0.1275f) {
    7.72                      /* if this next step will cause us to fade out completely
    7.73                         then just mark for deletion */
    7.74                      curr->isActive = 0;
    7.75                  } else {
    7.76                      /* otherwise, let's fade a bit more */
    7.77 -                    curr->color[3] -= MILLESECONDS_PER_FRAME * 0.1275f;
    7.78 +                    curr->color[3] -= deltaMilliseconds * 0.1275f;
    7.79                  }
    7.80  
    7.81                  /* if we're a dust particle, shrink our size */
    7.82                  if (curr->type == dust)
    7.83 -                    curr->size -= MILLESECONDS_PER_FRAME * 0.010f;
    7.84 +                    curr->size -= deltaMilliseconds * 0.010f;
    7.85  
    7.86              }
    7.87  
    7.88 @@ -147,7 +148,7 @@
    7.89      /* the number of active particles is computed as the difference between
    7.90         old number of active particles, where slot points, and the
    7.91         new size of the array, where particles points */
    7.92 -    num_active_particles = slot - particles;
    7.93 +    num_active_particles = (int) (slot - particles);
    7.94  }
    7.95  
    7.96  /*
    7.97 @@ -206,7 +207,7 @@
    7.98          p->y = emitter->y + emitter->yvel;
    7.99          p->isActive = 1;
   7.100          p->type = dust;
   7.101 -        p->size = 15;
   7.102 +        p->size = 15 * pointSizeScale;
   7.103          /* inherit emitter's color */
   7.104          p->color[0] = emitter->color[0];
   7.105          p->color[1] = emitter->color[1];
   7.106 @@ -244,7 +245,7 @@
   7.107      p->color[3] = (0.7f) * 255;
   7.108  
   7.109      /* set other attributes */
   7.110 -    p->size = 10;
   7.111 +    p->size = 10 * pointSizeScale;
   7.112      p->type = trail;
   7.113      p->isActive = 1;
   7.114  
   7.115 @@ -298,7 +299,7 @@
   7.116      p->xvel = 0;
   7.117      p->yvel = -sqrt(2 * ACCEL * (screen_h - y));
   7.118      /* set other attributes */
   7.119 -    p->size = 10;
   7.120 +    p->size = 10 * pointSizeScale;
   7.121      p->type = emitter;
   7.122      p->isActive = 1;
   7.123      /* our array has expanded at the end */
   7.124 @@ -363,7 +364,7 @@
   7.125  {
   7.126      SDL_Window *window;         /* main window */
   7.127      SDL_GLContext context;
   7.128 -    int w, h;
   7.129 +    int drawableW, drawableH;
   7.130      Uint32 startFrame;          /* time frame began to process */
   7.131      Uint32 endFrame;            /* time frame ended processing */
   7.132      Uint32 delay;               /* time to pause waiting to draw next frame */
   7.133 @@ -391,11 +392,19 @@
   7.134      SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
   7.135  
   7.136      /* create main window and renderer */
   7.137 -    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
   7.138 -                                SDL_WINDOW_OPENGL |
   7.139 -                                SDL_WINDOW_BORDERLESS);
   7.140 +    window = SDL_CreateWindow(NULL, 0, 0, 320, 480,
   7.141 +                                SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
   7.142      context = SDL_GL_CreateContext(window);
   7.143  
   7.144 +    /* The window size and drawable size may be different when highdpi is enabled,
   7.145 +     * due to the increased pixel density of the drawable. */
   7.146 +    SDL_GetWindowSize(window, &screen_w, &screen_h);
   7.147 +    SDL_GL_GetDrawableSize(window, &drawableW, &drawableH);
   7.148 +
   7.149 +    /* In OpenGL, point sizes are always in pixels. We don't want them looking
   7.150 +     * tiny on a retina screen. */
   7.151 +    pointSizeScale = (float) drawableH / (float) screen_h;
   7.152 +
   7.153      /* load the particle texture */
   7.154      initializeTexture();
   7.155  
   7.156 @@ -412,8 +421,7 @@
   7.157      glMatrixMode(GL_MODELVIEW);
   7.158      glLoadIdentity();
   7.159  
   7.160 -    SDL_GetWindowSize(window, &screen_w, &screen_h);
   7.161 -    glViewport(0, 0, screen_w, screen_h);
   7.162 +    glViewport(0, 0, drawableW, drawableH);
   7.163  
   7.164      glMatrixMode(GL_PROJECTION);
   7.165      glLoadIdentity();
   7.166 @@ -436,14 +444,14 @@
   7.167          glEnableClientState(GL_POINT_SIZE_ARRAY_OES);
   7.168      } else {
   7.169          /* if extension not available then all particles have size 10 */
   7.170 -        glPointSize(10);
   7.171 +        glPointSize(10 * pointSizeScale);
   7.172      }
   7.173  
   7.174      done = 0;
   7.175      /* enter main loop */
   7.176      while (!done) {
   7.177 -        startFrame = SDL_GetTicks();
   7.178          SDL_Event event;
   7.179 +        double deltaTime = updateDeltaTime();
   7.180          while (SDL_PollEvent(&event)) {
   7.181              if (event.type == SDL_QUIT) {
   7.182                  done = 1;
   7.183 @@ -454,19 +462,10 @@
   7.184                  spawnEmitterParticle(x, y);
   7.185              }
   7.186          }
   7.187 -        stepParticles();
   7.188 +        stepParticles(deltaTime);
   7.189          drawParticles();
   7.190          SDL_GL_SwapWindow(window);
   7.191 -        endFrame = SDL_GetTicks();
   7.192 -
   7.193 -        /* figure out how much time we have left, and then sleep */
   7.194 -        delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame);
   7.195 -        if (delay > MILLESECONDS_PER_FRAME) {
   7.196 -            delay = MILLESECONDS_PER_FRAME;
   7.197 -        }
   7.198 -        if (delay > 0) {
   7.199 -            SDL_Delay(delay);
   7.200 -        }
   7.201 +        SDL_Delay(1);
   7.202      }
   7.203  
   7.204      /* delete textures */
     8.1 --- a/Xcode-iOS/Demos/src/happy.c	Sun Sep 25 00:21:12 2016 -0300
     8.2 +++ b/Xcode-iOS/Demos/src/happy.c	Sun Sep 25 00:23:35 2016 -0300
     8.3 @@ -8,8 +8,7 @@
     8.4  #include "common.h"
     8.5  
     8.6  #define NUM_HAPPY_FACES 100     /* number of faces to draw */
     8.7 -#define MILLESECONDS_PER_FRAME 16       /* about 60 frames per second */
     8.8 -#define HAPPY_FACE_SIZE 32      /* width and height of happyface (pixels) */
     8.9 +#define HAPPY_FACE_SIZE 32      /* width and height of happyface */
    8.10  
    8.11  static SDL_Texture *texture = 0;    /* reference to texture holding happyface */
    8.12  
    8.13 @@ -24,30 +23,37 @@
    8.14      units of velocity are pixels per millesecond
    8.15  */
    8.16  void
    8.17 -initializeHappyFaces()
    8.18 +initializeHappyFaces(SDL_Renderer *renderer)
    8.19  {
    8.20      int i;
    8.21 +    int w;
    8.22 +    int h;
    8.23 +    SDL_RenderGetLogicalSize(renderer, &w, &h);
    8.24 +
    8.25      for (i = 0; i < NUM_HAPPY_FACES; i++) {
    8.26 -        faces[i].x = randomFloat(0.0f, SCREEN_WIDTH - HAPPY_FACE_SIZE);
    8.27 -        faces[i].y = randomFloat(0.0f, SCREEN_HEIGHT - HAPPY_FACE_SIZE);
    8.28 -        faces[i].xvel = randomFloat(-0.1f, 0.1f);
    8.29 -        faces[i].yvel = randomFloat(-0.1f, 0.1f);
    8.30 +        faces[i].x = randomFloat(0.0f, w - HAPPY_FACE_SIZE);
    8.31 +        faces[i].y = randomFloat(0.0f, h - HAPPY_FACE_SIZE);
    8.32 +        faces[i].xvel = randomFloat(-60.0f, 60.0f);
    8.33 +        faces[i].yvel = randomFloat(-60.0f, 60.0f);
    8.34      }
    8.35  }
    8.36  
    8.37  void
    8.38 -render(SDL_Renderer *renderer)
    8.39 +render(SDL_Renderer *renderer, double deltaTime)
    8.40  {
    8.41 -
    8.42      int i;
    8.43      SDL_Rect srcRect;
    8.44      SDL_Rect dstRect;
    8.45 +    int w;
    8.46 +    int h;
    8.47 +
    8.48 +    SDL_RenderGetLogicalSize(renderer, &w, &h);
    8.49  
    8.50      /* setup boundaries for happyface bouncing */
    8.51 -    Uint16 maxx = SCREEN_WIDTH - HAPPY_FACE_SIZE;
    8.52 -    Uint16 maxy = SCREEN_HEIGHT - HAPPY_FACE_SIZE;
    8.53 -    Uint16 minx = 0;
    8.54 -    Uint16 miny = 0;
    8.55 +    int maxx = w - HAPPY_FACE_SIZE;
    8.56 +    int maxy = h - HAPPY_FACE_SIZE;
    8.57 +    int minx = 0;
    8.58 +    int miny = 0;
    8.59  
    8.60      /* setup rects for drawing */
    8.61      srcRect.x = 0;
    8.62 @@ -68,8 +74,8 @@
    8.63         - draw
    8.64       */
    8.65      for (i = 0; i < NUM_HAPPY_FACES; i++) {
    8.66 -        faces[i].x += faces[i].xvel * MILLESECONDS_PER_FRAME;
    8.67 -        faces[i].y += faces[i].yvel * MILLESECONDS_PER_FRAME;
    8.68 +        faces[i].x += faces[i].xvel * deltaTime;
    8.69 +        faces[i].y += faces[i].yvel * deltaTime;
    8.70          if (faces[i].x > maxx) {
    8.71              faces[i].x = maxx;
    8.72              faces[i].xvel = -faces[i].xvel;
    8.73 @@ -123,48 +129,45 @@
    8.74  int
    8.75  main(int argc, char *argv[])
    8.76  {
    8.77 -
    8.78      SDL_Window *window;
    8.79      SDL_Renderer *renderer;
    8.80 -    Uint32 startFrame;
    8.81 -    Uint32 endFrame;
    8.82 -    Uint32 delay;
    8.83      int done;
    8.84 +    int width;
    8.85 +    int height;
    8.86  
    8.87      /* initialize SDL */
    8.88      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    8.89          fatalError("Could not initialize SDL");
    8.90      }
    8.91 -    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
    8.92 -                                SDL_WINDOW_OPENGL |
    8.93 -                                SDL_WINDOW_BORDERLESS);
    8.94 +
    8.95 +    /* The specified window size doesn't matter - except for its aspect ratio,
    8.96 +     * which determines whether the window is in portrait or landscape on iOS
    8.97 +     * (if SDL_WINDOW_RESIZABLE isn't specified). */
    8.98 +    window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_FULLSCREEN | SDL_WINDOW_ALLOW_HIGHDPI);
    8.99  
   8.100      renderer = SDL_CreateRenderer(window, -1, 0);
   8.101  
   8.102 +    SDL_GetWindowSize(window, &width, &height);
   8.103 +    SDL_RenderSetLogicalSize(renderer, width, height);
   8.104 +
   8.105      initializeTexture(renderer);
   8.106 -    initializeHappyFaces();
   8.107 +    initializeHappyFaces(renderer);
   8.108 +
   8.109  
   8.110      /* main loop */
   8.111      done = 0;
   8.112      while (!done) {
   8.113          SDL_Event event;
   8.114 -        startFrame = SDL_GetTicks();
   8.115 +        double deltaTime = updateDeltaTime();
   8.116 +
   8.117          while (SDL_PollEvent(&event)) {
   8.118              if (event.type == SDL_QUIT) {
   8.119                  done = 1;
   8.120              }
   8.121          }
   8.122 -        render(renderer);
   8.123 -        endFrame = SDL_GetTicks();
   8.124  
   8.125 -        /* figure out how much time we have left, and then sleep */
   8.126 -        delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame);
   8.127 -        if (delay < 0) {
   8.128 -            delay = 0;
   8.129 -        } else if (delay > MILLESECONDS_PER_FRAME) {
   8.130 -            delay = MILLESECONDS_PER_FRAME;
   8.131 -        }
   8.132 -        SDL_Delay(delay);
   8.133 +        render(renderer, deltaTime);
   8.134 +        SDL_Delay(1);
   8.135      }
   8.136  
   8.137      /* cleanup */
     9.1 --- a/Xcode-iOS/Demos/src/keyboard.c	Sun Sep 25 00:21:12 2016 -0300
     9.2 +++ b/Xcode-iOS/Demos/src/keyboard.c	Sun Sep 25 00:23:35 2016 -0300
     9.3 @@ -132,10 +132,13 @@
     9.4  void
     9.5  getPositionForCharNumber(int n, int *x, int *y)
     9.6  {
     9.7 +    int renderW, renderH;
     9.8 +    SDL_RenderGetLogicalSize(renderer, &renderW, &renderH);
     9.9 +
    9.10      int x_padding = 16;         /* padding space on left and right side of screen */
    9.11      int y_padding = 32;         /* padding space at top of screen */
    9.12      /* figure out the number of characters that can fit horizontally across the screen */
    9.13 -    int max_x_chars = (SCREEN_WIDTH - 2 * x_padding) / GLYPH_SIZE_SCREEN;
    9.14 +    int max_x_chars = (renderW - 2 * x_padding) / GLYPH_SIZE_SCREEN;
    9.15      int line_separation = 5;    /* pixels between each line */
    9.16      *x = (n % max_x_chars) * GLYPH_SIZE_SCREEN + x_padding;
    9.17      *y = (n / max_x_chars) * (GLYPH_SIZE_SCREEN + line_separation) +
    9.18 @@ -228,21 +231,25 @@
    9.19  int
    9.20  main(int argc, char *argv[])
    9.21  {
    9.22 -
    9.23      int index;                  /* index of last key we pushed in the bitmap font */
    9.24      SDL_Window *window;
    9.25      SDL_Event event;            /* last event received */
    9.26      SDL_Keymod mod;             /* key modifiers of last key we pushed */
    9.27      SDL_Scancode scancode;      /* scancode of last key we pushed */
    9.28 +    int width;
    9.29 +    int height;
    9.30  
    9.31      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
    9.32          printf("Error initializing SDL: %s", SDL_GetError());
    9.33      }
    9.34      /* create window */
    9.35 -    window = SDL_CreateWindow("iPhone keyboard test", 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
    9.36 +    window = SDL_CreateWindow("iPhone keyboard test", 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
    9.37      /* create renderer */
    9.38      renderer = SDL_CreateRenderer(window, -1, 0);
    9.39  
    9.40 +    SDL_GetWindowSize(window, &width, &height);
    9.41 +    SDL_RenderSetLogicalSize(renderer, width, height);
    9.42 +
    9.43      /* load up our font */
    9.44      loadFont();
    9.45  
    10.1 --- a/Xcode-iOS/Demos/src/mixer.c	Sun Sep 25 00:21:12 2016 -0300
    10.2 +++ b/Xcode-iOS/Demos/src/mixer.c	Sun Sep 25 00:23:35 2016 -0300
    10.3 @@ -33,7 +33,7 @@
    10.4  void handleMouseButtonDown(SDL_Event * event);
    10.5  void handleMouseButtonUp(SDL_Event * event);
    10.6  int playSound(struct sound *);
    10.7 -void initializeButtons();
    10.8 +void initializeButtons(SDL_Renderer *);
    10.9  void audioCallback(void *userdata, Uint8 * stream, int len);
   10.10  void loadSound(const char *file, struct sound *s);
   10.11  
   10.12 @@ -52,19 +52,21 @@
   10.13  
   10.14  /* sets up the buttons (color, position, state) */
   10.15  void
   10.16 -initializeButtons()
   10.17 +initializeButtons(SDL_Renderer *renderer)
   10.18  {
   10.19 -
   10.20      int i;
   10.21      int spacing = 10;           /* gap between drum buttons */
   10.22      SDL_Rect buttonRect;        /* keeps track of where to position drum */
   10.23      SDL_Color upColor = { 86, 86, 140, 255 };   /* color of drum when not pressed */
   10.24      SDL_Color downColor = { 191, 191, 221, 255 };       /* color of drum when pressed */
   10.25 +    int renderW, renderH;
   10.26 +
   10.27 +    SDL_RenderGetLogicalSize(renderer, &renderW, &renderH);
   10.28  
   10.29      buttonRect.x = spacing;
   10.30      buttonRect.y = spacing;
   10.31 -    buttonRect.w = SCREEN_WIDTH - 2 * spacing;
   10.32 -    buttonRect.h = (SCREEN_HEIGHT - (NUM_DRUMS + 1) * spacing) / NUM_DRUMS;
   10.33 +    buttonRect.w = renderW - 2 * spacing;
   10.34 +    buttonRect.h = (renderH - (NUM_DRUMS + 1) * spacing) / NUM_DRUMS;
   10.35  
   10.36      /* setup each button */
   10.37      for (i = 0; i < NUM_DRUMS; i++) {
   10.38 @@ -270,24 +272,23 @@
   10.39  int
   10.40  main(int argc, char *argv[])
   10.41  {
   10.42 -
   10.43      int done;                   /* has user tried to quit ? */
   10.44      SDL_Window *window;         /* main window */
   10.45      SDL_Renderer *renderer;
   10.46      SDL_Event event;
   10.47 -    Uint32 startFrame;          /* holds when frame started processing */
   10.48 -    Uint32 endFrame;            /* holds when frame ended processing */
   10.49 -    Uint32 delay;               /* calculated delay, how long should we wait before next frame? */
   10.50      int i;
   10.51 +    int width;
   10.52 +    int height;
   10.53  
   10.54      if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
   10.55          fatalError("could not initialize SDL");
   10.56      }
   10.57 -    window =
   10.58 -        SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
   10.59 -                         SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS);
   10.60 +    window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
   10.61      renderer = SDL_CreateRenderer(window, 0, 0);
   10.62  
   10.63 +    SDL_GetWindowSize(window, &width, &height);
   10.64 +    SDL_RenderSetLogicalSize(renderer, width, height);
   10.65 +
   10.66      /* initialize the mixer */
   10.67      SDL_memset(&mixer, 0, sizeof(mixer));
   10.68      /* setup output format */
   10.69 @@ -310,12 +311,11 @@
   10.70      loadSound("ds_china.wav", &drums[0]);
   10.71  
   10.72      /* setup positions, colors, and state of buttons */
   10.73 -    initializeButtons();
   10.74 +    initializeButtons(renderer);
   10.75  
   10.76      /* enter main loop */
   10.77      done = 0;
   10.78      while (!done) {
   10.79 -        startFrame = SDL_GetTicks();
   10.80          while (SDL_PollEvent(&event)) {
   10.81              switch (event.type) {
   10.82              case SDL_MOUSEBUTTONDOWN:
   10.83 @@ -330,16 +330,8 @@
   10.84              }
   10.85          }
   10.86          render(renderer);               /* draw buttons */
   10.87 -        endFrame = SDL_GetTicks();
   10.88  
   10.89 -        /* figure out how much time we have left, and then sleep */
   10.90 -        delay = MILLESECONDS_PER_FRAME - (endFrame - startFrame);
   10.91 -        if (delay < 0) {
   10.92 -            delay = 0;
   10.93 -        } else if (delay > MILLESECONDS_PER_FRAME) {
   10.94 -            delay = MILLESECONDS_PER_FRAME;
   10.95 -        }
   10.96 -        SDL_Delay(delay);
   10.97 +        SDL_Delay(1);
   10.98      }
   10.99  
  10.100      /* cleanup code, let's free up those sound buffers */
    11.1 --- a/Xcode-iOS/Demos/src/rectangles.c	Sun Sep 25 00:21:12 2016 -0300
    11.2 +++ b/Xcode-iOS/Demos/src/rectangles.c	Sun Sep 25 00:23:35 2016 -0300
    11.3 @@ -11,14 +11,18 @@
    11.4  void
    11.5  render(SDL_Renderer *renderer)
    11.6  {
    11.7 +    Uint8 r, g, b;
    11.8 +    int renderW;
    11.9 +    int renderH;
   11.10  
   11.11 -    Uint8 r, g, b;
   11.12 +    SDL_RenderGetLogicalSize(renderer, &renderW, &renderH);
   11.13 +
   11.14      /*  Come up with a random rectangle */
   11.15      SDL_Rect rect;
   11.16      rect.w = randomInt(64, 128);
   11.17      rect.h = randomInt(64, 128);
   11.18 -    rect.x = randomInt(0, SCREEN_WIDTH);
   11.19 -    rect.y = randomInt(0, SCREEN_HEIGHT);
   11.20 +    rect.x = randomInt(0, renderW);
   11.21 +    rect.y = randomInt(0, renderH);
   11.22  
   11.23      /* Come up with a random color */
   11.24      r = randomInt(50, 255);
   11.25 @@ -31,7 +35,6 @@
   11.26  
   11.27      /* update screen */
   11.28      SDL_RenderPresent(renderer);
   11.29 -
   11.30  }
   11.31  
   11.32  int
   11.33 @@ -42,6 +45,8 @@
   11.34      SDL_Renderer *renderer;
   11.35      int done;
   11.36      SDL_Event event;
   11.37 +    int windowW;
   11.38 +    int windowH;
   11.39  
   11.40      /* initialize SDL */
   11.41      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
   11.42 @@ -52,7 +57,7 @@
   11.43      srand(time(NULL));
   11.44  
   11.45      /* create window and renderer */
   11.46 -    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0);
   11.47 +    window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI);
   11.48      if (window == 0) {
   11.49          fatalError("Could not initialize Window");
   11.50      }
   11.51 @@ -61,6 +66,9 @@
   11.52          fatalError("Could not create renderer");
   11.53      }
   11.54  
   11.55 +    SDL_GetWindowSize(window, &windowW, &windowH);
   11.56 +    SDL_RenderSetLogicalSize(renderer, windowW, windowH);
   11.57 +
   11.58      /* Fill screen with black */
   11.59      SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255);
   11.60      SDL_RenderClear(renderer);
    12.1 --- a/Xcode-iOS/Demos/src/touch.c	Sun Sep 25 00:21:12 2016 -0300
    12.2 +++ b/Xcode-iOS/Demos/src/touch.c	Sun Sep 25 00:23:35 2016 -0300
    12.3 @@ -82,6 +82,7 @@
    12.4      SDL_Window *window;         /* main window */
    12.5      SDL_Renderer *renderer;
    12.6      int done;                   /* does user want to quit? */
    12.7 +    int w, h;
    12.8  
    12.9      /* initialize SDL */
   12.10      if (SDL_Init(SDL_INIT_VIDEO) < 0) {
   12.11 @@ -89,11 +90,12 @@
   12.12      }
   12.13  
   12.14      /* create main window and renderer */
   12.15 -    window = SDL_CreateWindow(NULL, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT,
   12.16 -                                SDL_WINDOW_OPENGL |
   12.17 -                                SDL_WINDOW_BORDERLESS);
   12.18 +    window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_BORDERLESS | SDL_WINDOW_ALLOW_HIGHDPI);
   12.19      renderer = SDL_CreateRenderer(window, 0, 0);
   12.20  
   12.21 +    SDL_GetWindowSize(window, &w, &h);
   12.22 +    SDL_RenderSetLogicalSize(renderer, w, h);
   12.23 +
   12.24      /* load brush texture */
   12.25      initializeTexture(renderer);
   12.26