Forked from
STJr / SRB2
-
Logan Aerl Arias authoredLogan Aerl Arias authored
README-ios.md 15.55 KiB
iOS
Building the Simple DirectMedia Layer for iOS 9.0+
Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK.
Instructions:
- Open SDL.xcodeproj (located in Xcode/SDL) in Xcode.
- Select your desired target, and hit build.
Using the Simple DirectMedia Layer for iOS
- Run Xcode and create a new project using the iOS Game template, selecting the Objective C language and Metal game technology.
- In the main view, delete all files except for Assets and LaunchScreen
- Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj
- Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name"
- Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left
- Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS"
- Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library.
- In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files
- Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function.
- Add any assets that your application needs.
- Enjoy!
TODO: Add information regarding App Store requirements such as icons, etc.
Notes -- Retina / High-DPI and window sizes
Window and display mode sizes in SDL are in "screen coordinates" (or "points", in Apple's terminology) rather than in pixels. On iOS this means that a window created on an iPhone 6 will have a size in screen coordinates of 375 x 667, rather than a size in pixels of 750 x 1334. All iOS apps are expected to size their content based on screen coordinates / points rather than pixels, as this allows different iOS devices to have different pixel densities (Retina versus non-Retina screens, etc.) without apps caring too much.