Example #1
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            //Set the Windows Phone screen resolution
            #if WIN8
            graphics.PreferredBackBufferWidth = 1376;
            graphics.PreferredBackBufferHeight = 768;
            //graphics.PreferredBackBufferWidth = Window.ClientBounds.Right + 1;
            //graphics.PreferredBackBufferHeight = Window.ClientBounds.Bottom + 1;
            #else
            //Default
            graphics.PreferredBackBufferWidth = 1376;
            graphics.PreferredBackBufferHeight = 768;
            #endif

            //graphics.IsFullScreen = false;

            Content.RootDirectory = "Content";

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromSeconds(1 / 60.0f);
            IsFixedTimeStep = true;

            //Create a new instance of the Screen Manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            AddInitialScreens();
        }
Example #2
0
        /// <summary>
        /// The constructor is private: loading screens should
        /// be activated via the static Load method instead.
        /// </summary>
        private LoadingScreen(ScreenManager screenManager, bool loadingIsSlow,
                              GameScreen[] screensToLoad)
        {
            this.loadingIsSlow = loadingIsSlow;
            this.screensToLoad = screensToLoad;

            // we don't serialize loading screens. if the user exits while the
            // game is at a loading screen, the game will resume at the screen
            // before the loading screen.
            IsSerializable = false;

            TransitionOnTime = TimeSpan.FromSeconds(0.5);
        }
Example #3
0
        /// <summary>
        /// Activates the loading screen.
        /// </summary>
        public static void Load(ScreenManager screenManager, bool loadingIsSlow,
                                PlayerIndex? controllingPlayer,
                                params GameScreen[] screensToLoad)
        {
            // Tell all the current screens to transition off.
            foreach (GameScreen screen in screenManager.GetScreens())
            {
                if (!screen.SaveScreen)
                    screen.ExitScreen();
            }
            // Create and activate the loading screen.
            LoadingScreen loadingScreen = new LoadingScreen(screenManager,
                                                            loadingIsSlow,
                                                            screensToLoad);

            screenManager.AddScreen(loadingScreen, controllingPlayer);
        }
Example #4
0
 public SnakePlayer(ScreenManager screenManager)
 {
     ScreenManager = screenManager;
     SpriteBatch = screenManager.SpriteBatch;
 }
 public CherryFoodTemplate(ScreenManager screenManager)
 {
     this.ScreenManager = screenManager;
     this.Content = screenManager.Game.Content;
 }
Example #6
0
        public static void ShowGameOver(ScreenManager screenManager, PlayerIndex? playerIndex)
        {
            if(gameOver == null)
                gameOver = new GameOverBox("You died!!");

            screenManager.AddScreen(gameOver, playerIndex);
        }
Example #7
0
        public static void ShowArcadeTimeUp(ScreenManager screenManager, PlayerIndex? playerIndex, int score)
        {
            arcadeTimeUp = new GameOverBox("Time up!" + Environment.NewLine + "Score: " + score.ToString());

            screenManager.AddScreen(arcadeTimeUp, playerIndex);
        }
Example #8
0
        public static void ShowLevelComplete(ScreenManager ScreenManager, PlayerIndex? ControllingPlayer, int score)
        {
            levelComplete = new LevelCompleteBox("Level Complete!" + Environment.NewLine + "Score: " + score.ToString());

            if(ScreenManager.GetScreens().Where(x=>x.GetType() == typeof(LevelCompleteBox)).FirstOrDefault() == null)
                ScreenManager.AddScreen(levelComplete, ControllingPlayer);
        }
 public SnakeDefaultTemplate(ScreenManager screenManager)
 {
     ScreenManager = screenManager;
     Content = screenManager.Game.Content;
 }