public iOSGamePlatform(Game game) :
            base(game)
        {
            game.Services.AddService(typeof(iOSGamePlatform), this);

            // Setup our OpenALSoundController to handle our SoundBuffer pools
            soundControllerInstance = OpenALSoundController.GetInstance;

            //This also runs the TitleContainer static constructor, ensuring it is done on the main thread
            Directory.SetCurrentDirectory(TitleContainer.Location);

            _applicationObservers = new List <NSObject>();

            #if !TVOS
            UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);
            #endif

            // Create a full-screen window
            _mainWindow = new UIWindow(UIScreen.MainScreen.Bounds);
            //_mainWindow.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            game.Services.AddService(typeof(UIWindow), _mainWindow);

            _viewController = new iOSGameViewController(this);
            game.Services.AddService(typeof(UIViewController), _viewController);
            Window = new iOSGameWindow(_viewController);

            _mainWindow.Add(_viewController.View);

            _viewController.InterfaceOrientationChanged += ViewController_InterfaceOrientationChanged;

            //(SJ) Why is this called here when it's not in any other project
            //Guide.Initialise(game);
        }
Example #2
0
        public iOSGamePlatform(Game game) :
            base(game)
        {
            game.Services.AddService(typeof(iOSGamePlatform), this);

            // Setup our OpenALSoundController to handle our SoundBuffer pools
            soundControllerInstance = OpenALSoundController.GetInstance;

            Directory.SetCurrentDirectory(NSBundle.MainBundle.ResourcePath);

            _applicationObservers = new List <NSObject>();

            UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);

            // Create a full-screen window
            _mainWindow = new UIWindow(UIScreen.MainScreen.Bounds);
            //_mainWindow.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            game.Services.AddService(typeof(UIWindow), _mainWindow);

            _viewController = new iOSGameViewController(this);
            game.Services.AddService(typeof(UIViewController), _viewController);
            Window = new iOSGameWindow(_viewController);

            _mainWindow.RootViewController = _viewController;
            _mainWindow.Add(_viewController.View);

            _viewController.InterfaceOrientationChanged += ViewController_InterfaceOrientationChanged;

            Guide.Initialise(game);
        }
Example #3
0
		public iOSGameWindow (iOSGameViewController viewController)
		{
			if (viewController == null)
				throw new ArgumentNullException("viewController");
			_viewController = viewController;
            _viewController.InterfaceOrientationChanged += HandleInterfaceOrientationChanged;
		}
Example #4
0
 public iOSGameWindow(iOSGameViewController viewController)
 {
     if (viewController == null)
     {
         throw new ArgumentNullException("viewController");
     }
     _viewController = viewController;
 }
Example #5
0
 public iOSGameWindow(iOSGameViewController viewController)
 {
     if (viewController == null)
     {
         throw new ArgumentNullException("viewController");
     }
     _viewController = viewController;
     _viewController.InterfaceOrientationChanged += HandleInterfaceOrientationChanged;
 }
        private bool PerformPendingExit()
        {
            if (!_isExitPending)
            {
                return(false);
            }

            _isExitPending = false;

            if (_displayLink != null)
            {
                _displayLink.Invalidate();
                _displayLink.Dispose();
                _displayLink = null;
            }

            UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Fade);

            if (_viewController != null)
            {
                _viewController.InterfaceOrientationChanged -= ViewController_InterfaceOrientationChanged;
                _viewController.View.RemoveFromSuperview();
                _viewController.View.Dispose();
                _viewController.RemoveFromParentViewController();
                //this might crash ventus?
                _viewController.Dispose();
                _viewController = null;
            }

            if (_mainWindow != null)
            {
                _mainWindow.RemoveFromSuperview();
                _mainWindow.Dispose();
                _mainWindow = null;
            }

            if (Window != null)
            {
                Window = null;
            }

            StopObservingUIApplication();
            RaiseAsyncRunLoopEnded();
            //this.Game=null;
            return(true);
        }
Example #7
0
        public iOSGamePlatform(Game game) : base(game)
        {
            game.Services.AddService(typeof(iOSGamePlatform), this);

            // Setup our OpenALSoundController to handle our SoundBuffer pools
            soundControllerInstance = OpenALSoundController.GetInstance;

            //This also runs the TitleContainer static constructor, ensuring it is done on the main thread
            Directory.SetCurrentDirectory(TitleContainer.Location);

            _applicationObservers = new List <NSObject> ();

            UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);

            #region Modification 23-06-2014
            // Move view controller creation before Window creation
            // Create our viewcontroller first, it will have a reference to the AspyCores service lib/obj
            _viewController = new iOSGameViewController(this);
            game.Services.AddService(typeof(AspyViewController), _viewController);

            // Create a full-screen window
            // AspyMod - Not needed as we will already have a window object instanced and ready to rock
            //_mainWindow = new UIWindow (UIScreen.MainScreen.Bounds);

            //_mainWindow.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            //game.Services.AddService (typeof(AspyWindow), _mainWindow);
            game.Services.AddService(typeof(AspyWindow), _viewController.iOSGlobals.G__MainWindow);

            Window = new iOSGameWindow(_viewController);

            //_mainWindow.RootViewController = _viewController;
            //_mainWindow.Add (_viewController.View);

            // AspyCore handles orientation??
            // During any screen rotations check this if monogame swaps itself.
            _viewController.InterfaceOrientationChanged += ViewController_InterfaceOrientationChanged;

            #endregion

            //(SJ) Why is this called here when it's not in any other project
            //Guide.Initialise(game);
        }
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                if (_viewController != null)
                {
                    _viewController.View.RemoveFromSuperview();
                    _viewController.RemoveFromParentViewController();
                    _viewController.Dispose();
                    _viewController = null;
                }

                if (_mainWindow != null)
                {
                    _mainWindow.Dispose();
                    _mainWindow = null;
                }
            }
        }
Example #9
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                if (_viewController != null)
                {
                    _viewController.View.RemoveFromSuperview();
                    _viewController.RemoveFromParentViewController();
                    _viewController.Dispose();
                    _viewController = null;
                }

                #region Modification 24-05-2014
                // MonoGame is no longer responsible for closing our window.
                //if (_mainWindow != null)
                //{
                //	_mainWindow.Dispose ();
                //	_mainWindow = null;
                //}
                #endregion
            }
        }
Example #10
0
        public iOSGamePlatform(Game game) :
            base(game)
        {
            game.Services.AddService(typeof(iOSGamePlatform), this);
			
			// Setup our OpenALSoundController to handle our SoundBuffer pools
			soundControllerInstance = OpenALSoundController.GetInstance;
			
            Directory.SetCurrentDirectory(NSBundle.MainBundle.ResourcePath);

            _applicationObservers = new List<NSObject>();

            UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);

            // Create a full-screen window
            _mainWindow = new UIWindow (UIScreen.MainScreen.Bounds);
			//_mainWindow.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
			
            game.Services.AddService (typeof(UIWindow), _mainWindow);

            _viewController = new iOSGameViewController(this);
            game.Services.AddService (typeof(UIViewController), _viewController);
            Window = new iOSGameWindow (_viewController);

            _mainWindow.RootViewController = _viewController;
            _mainWindow.Add (_viewController.View);

            _viewController.InterfaceOrientationChanged += ViewController_InterfaceOrientationChanged;

            Guide.Initialise(game);
        }
Example #11
0
        private bool PerformPendingExit()
        {
            if (!_isExitPending)
                return false;

            _isExitPending = false;

            if (_caDisplayLink != null) {
                _caDisplayLink.Invalidate();
                _caDisplayLink.Dispose();
                _caDisplayLink = null;
            }

            UIApplication.SharedApplication.SetStatusBarHidden(false, UIStatusBarAnimation.Fade);

            if (_viewController != null)
            {
                _viewController.InterfaceOrientationChanged -= ViewController_InterfaceOrientationChanged;
                _viewController.View.RemoveFromSuperview ();
                _viewController.View.Dispose();
                _viewController.RemoveFromParentViewController ();
                //this might crash ventus?
                _viewController.Dispose();
                _viewController = null;
            }

            if (_mainWindow != null)
            {
                _mainWindow.RemoveFromSuperview();
                _mainWindow.Dispose();
                _mainWindow = null;
            }

            if (Window != null)
            {
                Window = null;
            }

            Net.NetworkSession.Exit();

            StopObservingUIApplication ();
            RaiseAsyncRunLoopEnded ();
            //this.Game=null;
            return true;
        }
Example #12
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
            if (disposing)
            {
                if (_viewController != null)
                {
                    _viewController.View.RemoveFromSuperview ();
                    _viewController.RemoveFromParentViewController ();
                    _viewController.Dispose();
                    _viewController = null;
                }

                if (_mainWindow != null)
                {
                    _mainWindow.Dispose();
                    _mainWindow = null;
                }
            }
        }
Example #13
0
        public iOSGamePlatform(Game game) :
            base(game)
        {
            game.Services.AddService(typeof(iOSGamePlatform), this);
			
			// Setup our OpenALSoundController to handle our SoundBuffer pools
			soundControllerInstance = OpenALSoundController.GetInstance;

            //This also runs the TitleContainer static constructor, ensuring it is done on the main thread
            Directory.SetCurrentDirectory(TitleContainer.Location);

            _applicationObservers = new List<NSObject>();

            UIApplication.SharedApplication.SetStatusBarHidden(true, UIStatusBarAnimation.Fade);

            // Create a full-screen window
            _mainWindow = new UIWindow (UIScreen.MainScreen.Bounds);
			//_mainWindow.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;
			
            game.Services.AddService (typeof(UIWindow), _mainWindow);

            _viewController = new iOSGameViewController(this);
            game.Services.AddService (typeof(UIViewController), _viewController);
            Window = new iOSGameWindow (_viewController);

            _mainWindow.RootViewController = _viewController;
            _mainWindow.Add (_viewController.View);

            _viewController.InterfaceOrientationChanged += ViewController_InterfaceOrientationChanged;

            //(SJ) Why is this called here when it's not in any other project
            //Guide.Initialise(game);
        }
Example #14
0
		public iOSGameWindow (iOSGameViewController viewController)
		{
			if (viewController == null)
				throw new ArgumentNullException("viewController");
			_viewController = viewController;
		}