Esempio n. 1
0
        public StartScene(Game game, SpriteBatch spriteBatch, Texture2D menuImage)
            : base(game, spriteBatch)
        {
            this.spriteBatch = spriteBatch;

            //Add the background scrolling images
            backgroundImages = new List<Texture2D>
            {
                game.Content.Load<Texture2D>("Images/Menu-Background-1"),
                game.Content.Load<Texture2D>("Images/Menu-Background-2"),
                game.Content.Load<Texture2D>("Images/Menu-Background-3")
            };

            //Randomize the assigned texure
            Random r = new Random();
            scrollingTexture1 = backgroundImages[r.Next(0, backgroundImages.Count)];
            scrollingTexture2 = backgroundImages[r.Next(0, backgroundImages.Count)];

            //Set original positions of the scrolling backgrounds
            scrollingPosition1 = Vector2.Zero;
            scrollingPosition2 = new Vector2(scrollingPosition1.X + scrollingTexture1.Width, scrollingPosition1.Y);
            scrollingSpeed = new Vector2(1.0f, 0.0f);

            //Set up the menu
            Vector2 menuPosition = new Vector2(Utilities.Utilities.Stage.X / 2 + 140, Utilities.Utilities.Stage.Y / 2 - 110);
            Menu = new MenuComponent(game, spriteBatch,
                game.Content.Load<SpriteFont>("Fonts/MenuFont"),
                menuItems, menuPosition);
            this.Components.Add(Menu);

            this.menuImage = menuImage;
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor for the Pause Menu Scene
        /// </summary>
        /// <param name="game">The game which calls the pause menu</param>
        /// <param name="spriteBatch">The spritebatch used to draw this menu</param>
        public PauseMenuScene(Game game, SpriteBatch spriteBatch, Texture2D menuImage)
            : base(game, spriteBatch)
        {
            Vector2 menuPosition = new Vector2(Utilities.Utilities.Stage.X / 2 - 155, Utilities.Utilities.Stage.Y / 2 - 110);
            Menu = new MenuComponent(game, spriteBatch,
                game.Content.Load<SpriteFont>("Fonts/MenuFont"),
                menuItems, menuPosition);
            this.Components.Add(Menu);

            this.menuImage = menuImage;
        }