Mercurial > sdl-ios-xcode
diff src/main/beos/SDL_BeApp.cc @ 1662:782fd950bd46 SDL-1.3
Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
WARNING: None of the video drivers have been updated for the new API yet! The API is still under design and very fluid.
The code is now run through a consistent indent format:
indent -i4 -nut -nsc -br -ce
The headers are being converted to automatically generate doxygen documentation.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 28 May 2006 13:04:16 +0000 |
parents | 376665398b25 |
children | 4da1ee79c9af |
line wrap: on
line diff
--- a/src/main/beos/SDL_BeApp.cc Sun May 21 17:27:13 2006 +0000 +++ b/src/main/beos/SDL_BeApp.cc Sun May 28 13:04:16 2006 +0000 @@ -37,73 +37,79 @@ int SDL_BeAppActive = 0; static SDL_Thread *SDL_AppThread = NULL; -static int StartBeApp(void *unused) +static int +StartBeApp (void *unused) { - BApplication *App; + BApplication *App; - App = new BApplication("application/x-SDL-executable"); + App = new BApplication ("application/x-SDL-executable"); - App->Run(); - delete App; - return(0); + App->Run (); + delete App; + return (0); } /* Initialize the Be Application, if it's not already started */ -int SDL_InitBeApp(void) +int +SDL_InitBeApp (void) { - /* Create the BApplication that handles appserver interaction */ - if ( SDL_BeAppActive <= 0 ) { - SDL_AppThread = SDL_CreateThread(StartBeApp, NULL); - if ( SDL_AppThread == NULL ) { - SDL_SetError("Couldn't create BApplication thread"); - return(-1); - } - - /* Change working to directory to that of executable */ - app_info info; - if (B_OK == be_app->GetAppInfo(&info)) { - entry_ref ref = info.ref; - BEntry entry; - if (B_OK == entry.SetTo(&ref)) { - BPath path; - if (B_OK == path.SetTo(&entry)) { - if (B_OK == path.GetParent(&path)) { - chdir(path.Path()); - } - } - } - } - - do { - SDL_Delay(10); - } while ( (be_app == NULL) || be_app->IsLaunching() ); + /* Create the BApplication that handles appserver interaction */ + if (SDL_BeAppActive <= 0) { + SDL_AppThread = SDL_CreateThread (StartBeApp, NULL); + if (SDL_AppThread == NULL) { + SDL_SetError ("Couldn't create BApplication thread"); + return (-1); + } - /* Mark the application active */ - SDL_BeAppActive = 0; - } + /* Change working to directory to that of executable */ + app_info info; + if (B_OK == be_app->GetAppInfo (&info)) { + entry_ref ref = info.ref; + BEntry entry; + if (B_OK == entry.SetTo (&ref)) { + BPath path; + if (B_OK == path.SetTo (&entry)) { + if (B_OK == path.GetParent (&path)) { + chdir (path.Path ()); + } + } + } + } - /* Increment the application reference count */ - ++SDL_BeAppActive; + do { + SDL_Delay (10); + } + while ((be_app == NULL) || be_app->IsLaunching ()); - /* The app is running, and we're ready to go */ - return(0); + /* Mark the application active */ + SDL_BeAppActive = 0; + } + + /* Increment the application reference count */ + ++SDL_BeAppActive; + + /* The app is running, and we're ready to go */ + return (0); } /* Quit the Be Application, if there's nothing left to do */ -void SDL_QuitBeApp(void) +void +SDL_QuitBeApp (void) { - /* Decrement the application reference count */ - --SDL_BeAppActive; + /* Decrement the application reference count */ + --SDL_BeAppActive; - /* If the reference count reached zero, clean up the app */ - if ( SDL_BeAppActive == 0 ) { - if ( SDL_AppThread != NULL ) { - if ( be_app != NULL ) { /* Not tested */ - be_app->PostMessage(B_QUIT_REQUESTED); - } - SDL_WaitThread(SDL_AppThread, NULL); - SDL_AppThread = NULL; - } - /* be_app should now be NULL since be_app has quit */ - } + /* If the reference count reached zero, clean up the app */ + if (SDL_BeAppActive == 0) { + if (SDL_AppThread != NULL) { + if (be_app != NULL) { /* Not tested */ + be_app->PostMessage (B_QUIT_REQUESTED); + } + SDL_WaitThread (SDL_AppThread, NULL); + SDL_AppThread = NULL; + } + /* be_app should now be NULL since be_app has quit */ + } } + +/* vi: set ts=4 sw=4 expandtab: */