public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
			if(Game == null)
				throw new InvalidOperationException("Please set 'Game' to a valid instance of Game before calling this method.");
				
            var bounds = UIScreen.MainScreen.Bounds;

            // create the game main windows
            MainWindow = new UIWindow(bounds);

            // create the paradox game view 
            var paradoxGameView = new iOSParadoxView((RectangleF)bounds) {ContentScaleFactor = UIScreen.MainScreen.Scale};

            // create the view controller used to display the paradox game
            var paradoxGameController = new ParadoxGameController { View = paradoxGameView };

            // create the game context
            var gameContext = new GameContext(MainWindow, paradoxGameView, paradoxGameController);

            // Force fullscreen
            UIApplication.SharedApplication.SetStatusBarHidden(true, false);

            // Added UINavigationController to switch between UIViewController because the game is killed if the FinishedLaunching (in the AppDelegate) method doesn't return true in 10 sec.
            var navigationController = new UINavigationController {NavigationBarHidden = true};
            navigationController.PushViewController(gameContext.GameViewController, false);
            MainWindow.RootViewController = navigationController;

            // launch the main window
            MainWindow.MakeKeyAndVisible();

            // launch the game
            Game.Run(gameContext);

            return Game.IsRunning;
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameContext" /> class.
 /// </summary>
 /// <param name="mainWindows">The main windows of the game</param>
 /// <param name="gameView">The view in which the game is rendered</param>
 /// <param name="gameViewController">The paradox game main controller</param>
 /// <param name="requestedWidth">Width of the requested.</param>
 /// <param name="requestedHeight">Height of the requested.</param>
 public GameContext(UIWindow mainWindows, iPhoneOSGameView gameView, ParadoxGameController gameViewController, int requestedWidth = 0, int requestedHeight = 0)
 {
     MainWindow = mainWindows;
     GameView = gameView;
     GameViewController = gameViewController;
     RequestedWidth = requestedWidth;
     RequestedHeight = requestedHeight;
     ContextType = AppContextType.iOS;
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GameContext" /> class.
 /// </summary>
 /// <param name="mainWindows">The main windows of the game</param>
 /// <param name="gameView">The view in which the game is rendered</param>
 /// <param name="gameViewController">The paradox game main controller</param>
 /// <param name="requestedWidth">Width of the requested.</param>
 /// <param name="requestedHeight">Height of the requested.</param>
 public GameContext(UIWindow mainWindows, iPhoneOSGameView gameView, ParadoxGameController gameViewController, int requestedWidth = 0, int requestedHeight = 0)
 {
     MainWindow         = mainWindows;
     GameView           = gameView;
     GameViewController = gameViewController;
     RequestedWidth     = requestedWidth;
     RequestedHeight    = requestedHeight;
     ContextType        = AppContextType.iOS;
 }