Example #1
0
        public SelectLoadingLevelScene(Game game, SpriteFont font,
            Texture2D background, Texture2D teamLogo, GraphicsDevice graphicDevice)
            : base(game)
        {
            this.teamLogo = teamLogo;
            this.font = font;
            this.graphicsDevice = graphicDevice;
            Components.Add(new ImageComponent(game, background,
                                            ImageComponent.DrawMode.Stretch));

            // Get the current spritebatch
            spriteBatch = (SpriteBatch)Game.Services.GetService(
                                            typeof(SpriteBatch));

            menu = new TextMenuComponent(game, font, font);
            Components.Add(menu);
            cursor = new Cursor(game, spriteBatch);
        }
Example #2
0
        public StartScene(Game game, SpriteFont smallFont, SpriteFont largeFont,
            Texture2D background, Texture2D elements, Texture2D teamLogo, GraphicsDevice graphicDevice)
            : base(game)
        {
            this.elements = elements;
            this.teamLogo = teamLogo;
            this.game = game;
            this.graphicsDevice = graphicDevice;

            widthScale = (float)game.Window.ClientBounds.Width / 1440;
            heightScale = (float)game.Window.ClientBounds.Height / 900;

            //textScale = widthScale * heightScale;
            //if (textScale > 1) textScale = 1;

            GameConstants.generalTextScaleFactor = (float)Math.Sqrt((double)widthScale * (double)heightScale);

            if (GameConstants.generalTextScaleFactor > 1)
                GameConstants.generalTextScaleFactor = 1;

            titleLine1SrcRect = new Rectangle(0, 0, 588, 126);//Hydrobot (0,0, 588, 126)
            titleLine2SrcRect = new Rectangle(90, 169, 620, 126); //Adventure (90, 169, 620, 126)

            Components.Add(new ImageComponent(game, background,
                                            ImageComponent.DrawMode.Stretch));

            // Create the Menu
            if (File.Exists("SurvivalMode"))
            {
                string[] items = { "New Game", "New Game Plus", "Load Saved Level", "Guardian Mode", "Config", "Help", "Credits", "Quit" };
                menuItems = items;
            }
            else
            {
                string[] items = { "New Game", "Load Saved Level", "Config", "Help", "Credits", "Quit" };
                menuItems = items;
            }

            menu = new TextMenuComponent(game, smallFont, largeFont);

            //starting values
            resetMenuStartPosition();

            menu.Position = new Vector2((game.Window.ClientBounds.Width / 2) , titleLine2DestRect.Bottom);

            menu.SetMenuItems(menuItems);
            Components.Add(menu);

            // Get the current spritebatch
            spriteBatch = (SpriteBatch)Game.Services.GetService(
                                            typeof(SpriteBatch));

            // Get the audio library
            audio = (AudioLibrary)
                Game.Services.GetService(typeof(AudioLibrary));

            cursor = new Cursor(game, spriteBatch);
        }