docs/README-ios.md
changeset 9995 d79480c1e151
parent 9810 1e079120100e
child 9997 e330f785a5e7
     1.1 --- a/docs/README-ios.md	Thu Dec 31 15:26:40 2015 -0400
     1.2 +++ b/docs/README-ios.md	Thu Dec 31 21:16:43 2015 -0400
     1.3 @@ -47,17 +47,45 @@
     1.4  FIXME: This needs to be updated for the latest methods
     1.5  
     1.6  Here is the easiest method:
     1.7 -1.  Build the SDL libraries (libSDL.a and libSDLSimulator.a) and the iPhone SDL Application template.
     1.8 -2.  Install the iPhone SDL Application template by copying it to one of XCode's template directories.  I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/XCode/Project Templates/" and placing it there.
     1.9 +1.  Build the SDL library (libSDL2.a) and the iPhone SDL Application template.
    1.10 +2.  Install the iPhone SDL Application template by copying it to one of Xcode's template directories.  I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/Xcode/Project Templates/" and placing it there.
    1.11  3.  Start a new project using the template.  The project should be immediately ready for use with SDL.
    1.12  
    1.13  Here is a more manual method:
    1.14 -1.  Create a new iPhone view based application.
    1.15 -2.  Build the SDL static libraries (libSDL.a and libSDLSimulator.a) for iPhone and include them in your project.  XCode will ignore the library that is not currently of the correct architecture, hence your app will work both on iPhone and in the iPhone Simulator.
    1.16 +1.  Create a new iOS view based application.
    1.17 +2.  Build the SDL static library (libSDL2.a) for iOS and include them in your project.  Xcode will ignore the library that is not currently of the correct architecture, hence your app will work both on iOS and in the iOS Simulator.
    1.18  3.  Include the SDL header files in your project.
    1.19 -4.  Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iPhone provides its own UIApplicationDelegate.  Remove MainWindow.xib -- SDL for iPhone produces its user interface programmatically.
    1.20 -5.  Delete the contents of main.m and program your app as a regular SDL program instead.  You may replace main.m with your own main.c, but you must tell XCode not to use the project prefix file, as it includes Objective-C code.
    1.21 +4.  Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iOS provides its own UIApplicationDelegate.  Remove MainWindow.xib -- SDL for iOS produces its user interface programmatically.
    1.22 +5.  Delete the contents of main.m and program your app as a regular SDL program instead.  You may replace main.m with your own main.c, but you must tell Xcode not to use the project prefix file, as it includes Objective-C code.
    1.23 +
    1.24 +==============================================================================
    1.25 +Notes -- Retina / High-DPI and window sizes
    1.26 +==============================================================================
    1.27 +
    1.28 +Window and display mode sizes in SDL are in "screen coordinates" (or "points",
    1.29 +in Apple's terminology) rather than in pixels. On iOS this means that a window
    1.30 +created on an iPhone 6 will have a size in screen cooordinates of 375 x 667,
    1.31 +rather than a size in pixels of 750 x 1334. All iOS apps are expected to
    1.32 +size their content based on screen coordinates / points rather than pixels,
    1.33 +as this allows different iOS devices to have different pixel densities
    1.34 +(Retina versus non-Retina screens, etc.) without apps caring too much.
    1.35  
    1.36 +By default SDL will not use the full pixel density of the screen on
    1.37 +Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when
    1.38 +creating your window to enable high-dpi support.
    1.39 +
    1.40 +When high-dpi support is enabled, SDL_GetWindowSize and display mode sizes
    1.41 +will still be in "screen coordinates" rather than pixels, but the window will
    1.42 +have a much greater pixel density when the device supports it, and the
    1.43 +SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize functions (depending on
    1.44 +whether raw OpenGL or the SDL_Render API is used) can be queried to determine
    1.45 +the size in pixels of the drawable screen framebuffer.
    1.46 +
    1.47 +Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
    1.48 +sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
    1.49 +orthographic projection matrix using the size in screen coordinates
    1.50 +(SDL_GetWindowSize) can be used in order to display content at the same scale
    1.51 +no matter whether a Retina device is used or not.
    1.52  
    1.53  ==============================================================================
    1.54  Notes -- Application events
    1.55 @@ -203,7 +231,7 @@
    1.56  Game Center 
    1.57  ==============================================================================
    1.58  
    1.59 -Game Center integration requires that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
    1.60 +Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
    1.61  
    1.62      int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
    1.63