Пример #1
0
        public FarseerXNAWP7Game()
        {
            Window.Title = "BOUNCE BALL";

            _graphics = new GraphicsDeviceManager(this);
            _graphics.SynchronizeWithVerticalRetrace = false;
            _graphics.PreferMultiSampling = true;

            _graphics.PreferredBackBufferWidth = 800;
            _graphics.PreferredBackBufferHeight = 480;
            _graphics.IsFullScreen = true;
            IsFixedTimeStep = false;

            Content.RootDirectory = "Content";
            IsMouseVisible = true;

            ScreenManager = new ScreenManager(this);
            Components.Add(ScreenManager);

            //TODO:Vinit - Remove from final Version
            //FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager);
            //frameRateCounter.DrawOrder = 101;
            //Components.Add(frameRateCounter);

            //Handle Tombstoning....
            PhoneApplicationService.Current.Deactivated += (_, __) =>
                {
                    if (_startScreen != null)
                    {
                        PhoneApplicationService.Current.State.Clear();
                        FarseerXNAWP7.Helpers.ResumeState ResumeState = _startScreen.ResumeState;
                        if (ResumeState != null)
                        {
                            PhoneApplicationService.Current.State.Add("RESUMESTATE", ResumeState);
                        }
                    }
                };

            PhoneApplicationService.Current.Activated += (_, __) =>
                {
                    if (PhoneApplicationService.Current.State.ContainsKey("RESUMESTATE"))
                    {
                        _startScreen = new StartScreen((ResumeState)PhoneApplicationService.Current.State["RESUMESTATE"]);
                        _startScreen.ExitGame += (s, e) => { this.Exit(); };
                        ScreenManager.AddScreen(_startScreen, null);
                        _startScreen.LoadLevelScreen();
                        PhoneApplicationService.Current.State.Clear();
                    }
                    else
                    {
                        WelcomeScreen();
                    }
                };

            PhoneApplicationService.Current.Launching += (_, __) =>
                {
                    WelcomeScreen();
                };
        }
Пример #2
0
        private void WelcomeScreen()
        {
            _startScreen = new StartScreen();
            _startScreen.ExitGame += (s, e) => { this.Exit(); };
            ScreenManager.AddScreen(_startScreen, null);

            //ScreenManager.AddScreen(new temp2(), null);
        }