Advertisement
spacechase0

Changes

Dec 4th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main(int argc, char** argv)
  2. {
  3.     // Note: we intentionally drop command line arguments,
  4.     // there's no such thing as a command line on an iOS device :)
  5.  
  6. std::cout<<"In the real main!" << std::endl;
  7.     // Important: "SFAppDelegate" must always match the name of the
  8.     // application delegate class defined in sfml-window
  9.  
  10.     return UIApplicationMain(argc, argv, nil, @"SFAppDelegate");
  11. }
  12.  
  13. ////////////////////////////////////////////////////////////
  14. -(void)runUserMain
  15. {
  16.     // Arguments intentionally dropped, see comments in main in sfml-main
  17.     std::cout<<"Running user main" << std::endl;
  18.     sfmlMain(0, NULL);
  19. }
  20.  
  21. ////////////////////////////////////////////////////////////
  22. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  23. {
  24. std::cout<<"Did finish launching" << std::endl;
  25.     // Save the delegate instance
  26.     delegateInstance = self;
  27.  
  28.     // Instanciate the motion manager
  29.     self.motionManager = [[CMMotionManager alloc] init];
  30.  
  31.     // Register orientation changes notifications
  32.     [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
  33.     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object: nil];
  34.  
  35.     // Change the working directory to the resources directory
  36.     [[NSFileManager defaultManager] changeCurrentDirectoryPath: [[NSBundle mainBundle] resourcePath]];
  37.  
  38. std::cout << "Scheduling call to to call user main" << std::endl;
  39.     // Schedule an indirect call to the user main, so that this call (and the whole
  40.     // init sequence) can end, and the default splashscreen can be destroyed
  41.     [self performSelector:@selector(runUserMain) withObject:nil afterDelay:0.0];
  42.     std::cout << "Post-schedule." << std::endl;
  43.  
  44.     return true;
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement