コード例 #1
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>();

            #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);
        }
コード例 #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);
        }
コード例 #3
0
ファイル: iOSGameWindow.cs プロジェクト: Zodge/MonoGame
		public iOSGameWindow (iOSGameViewController viewController)
		{
			if (viewController == null)
				throw new ArgumentNullException("viewController");
			_viewController = viewController;
            _viewController.InterfaceOrientationChanged += HandleInterfaceOrientationChanged;
		}
コード例 #4
0
ファイル: IOSGameWindow.cs プロジェクト: valsavva/dynacat
 public iOSGameWindow(iOSGameViewController viewController)
 {
     if (viewController == null)
     {
         throw new ArgumentNullException("viewController");
     }
     _viewController = viewController;
 }
コード例 #5
0
ファイル: iOSGameWindow.cs プロジェクト: chubbyerror/Gibbo2D
 public iOSGameWindow(iOSGameViewController viewController)
 {
     if (viewController == null)
     {
         throw new ArgumentNullException("viewController");
     }
     _viewController = viewController;
     _viewController.InterfaceOrientationChanged += HandleInterfaceOrientationChanged;
 }
コード例 #6
0
        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);
        }
コード例 #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);
        }
コード例 #8
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;
                }
            }
        }
コード例 #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
            }
        }
コード例 #10
0
ファイル: iOSGamePlatform.cs プロジェクト: RMall/MonoGame3.2
        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);
        }
コード例 #11
0
ファイル: iOSGamePlatform.cs プロジェクト: RMall/MonoGame3.2
        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;
        }
コード例 #12
0
ファイル: iOSGamePlatform.cs プロジェクト: RMall/MonoGame3.2
        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;
                }
            }
        }
コード例 #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);
        }
コード例 #14
0
ファイル: IOSGameWindow.cs プロジェクト: adison/Tank-Wars
		public iOSGameWindow (iOSGameViewController viewController)
		{
			if (viewController == null)
				throw new ArgumentNullException("viewController");
			_viewController = viewController;
		}