docs/README-ios.md
changeset 9066 c2af3ff967cc
parent 9064 428bff5bf38a
child 9810 1e079120100e
     1.1 --- a/docs/README-ios.md	Fri Aug 15 23:18:57 2014 +0200
     1.2 +++ b/docs/README-ios.md	Fri Aug 15 23:39:14 2014 +0200
     1.3 @@ -14,11 +14,12 @@
     1.4  There are three build targets:
     1.5  - libSDL.a:
     1.6  	Build SDL as a statically linked library
     1.7 -- testsdl
     1.8 +- testsdl:
     1.9  	Build a test program (there are known test failures which are fine)
    1.10  - Template:
    1.11  	Package a project template together with the SDL for iPhone static libraries and copies of the SDL headers.  The template includes proper references to the SDL library and headers, skeleton code for a basic SDL program, and placeholder graphics for the application icon and startup screen.
    1.12  
    1.13 +
    1.14  ==============================================================================
    1.15  Build SDL for iOS from the command line
    1.16  ==============================================================================
    1.17 @@ -57,6 +58,7 @@
    1.18  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.19  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.20  
    1.21 +
    1.22  ==============================================================================
    1.23  Notes -- Application events
    1.24  ==============================================================================
    1.25 @@ -148,11 +150,14 @@
    1.26  
    1.27  void SDL_StartTextInput()
    1.28  	-- enables text events and reveals the onscreen keyboard.
    1.29 +
    1.30  void SDL_StopTextInput()
    1.31  	-- disables text events and hides the onscreen keyboard.
    1.32 +
    1.33  SDL_bool SDL_IsTextInputActive()
    1.34  	-- returns whether or not text events are enabled (and the onscreen keyboard is visible)
    1.35  
    1.36 +
    1.37  ==============================================================================
    1.38  Notes -- Reading and Writing files
    1.39  ==============================================================================
    1.40 @@ -161,12 +166,12 @@
    1.41  
    1.42  Once your application is installed its directory tree looks like:
    1.43  
    1.44 -MySDLApp Home/
    1.45 -	MySDLApp.app
    1.46 -	Documents/
    1.47 -	Library/
    1.48 -		Preferences/
    1.49 -	tmp/
    1.50 +    MySDLApp Home/
    1.51 +        MySDLApp.app
    1.52 +        Documents/
    1.53 +        Library/
    1.54 +            Preferences/
    1.55 +        tmp/
    1.56  
    1.57  When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored.  You cannot write to this directory.  Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".  
    1.58  
    1.59 @@ -191,8 +196,8 @@
    1.60  ==============================================================================
    1.61  
    1.62  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.63 -    
    1.64 -int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
    1.65 +
    1.66 +    int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
    1.67  
    1.68  This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
    1.69  
    1.70 @@ -201,7 +206,7 @@
    1.71      extern "C"
    1.72      void ShowFrame(void*)
    1.73      {
    1.74 -        ... do event handling, frame logic and rendering
    1.75 +        ... do event handling, frame logic and rendering ...
    1.76      }
    1.77      
    1.78      int main(int argc, char *argv[])
    1.79 @@ -209,17 +214,17 @@
    1.80          ... initialize game ...
    1.81      
    1.82      #if __IPHONEOS__
    1.83 -            // Initialize the Game Center for scoring and matchmaking
    1.84 -            InitGameCenter();
    1.85 +        // Initialize the Game Center for scoring and matchmaking
    1.86 +        InitGameCenter();
    1.87      
    1.88 -            // Set up the game to run in the window animation callback on iOS
    1.89 -            // so that Game Center and so forth works correctly.
    1.90 -            SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
    1.91 +        // Set up the game to run in the window animation callback on iOS
    1.92 +        // so that Game Center and so forth works correctly.
    1.93 +        SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
    1.94      #else
    1.95 -            while ( running ) {
    1.96 -                    ShowFrame(0);
    1.97 -                    DelayFrame();
    1.98 -            }
    1.99 +        while ( running ) {
   1.100 +            ShowFrame(0);
   1.101 +            DelayFrame();
   1.102 +        }
   1.103      #endif
   1.104 -            return 0;
   1.105 +        return 0;
   1.106      }