/// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            gameState = GameState.titleScreen;
            prevGameState = gameState;
            inputHandler = new InputHandler();

            plotScreen = new PlotScreen(this, musicPlayer, textures, fonts);
            level = new Level(this, textures, fonts, sounds, musicPlayer, plotScreen, new LevelLoader(config.LevelFiles), inputHandler);
            tutorial = new Level(this, textures, fonts, sounds, musicPlayer, null, new LevelLoader(config.TutorialFiles), inputHandler);
            gameOver = new GameOver(this, (Texture2D)textures[3], (SpriteFont)fonts[2], inputHandler);
            titleScreen = new TitleScreen(this, (Texture2D)textures[7], (Texture2D)textures[16], (SpriteFont)fonts[2], musicPlayer, inputHandler);
            titleMenu = new TitleMenu(this, (Texture2D)textures[7], (SpriteFont)fonts[2], inputHandler);
            levelIntroScreen = new LevelIntroScreen(this, (SpriteFont)fonts[1]);
            levelIntroScreen.InitLevelScreen(level.LevelName);

            credits = new Credits(this, (Texture2D)textures[creditsIndex], musicPlayer, fonts);

            playerAnimation = new PlayerAnimation(this, new Player(this, (Texture2D)textures[0], sounds, -100, 400));
            animatePlayer = false;
        }
Exemple #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            gameState = GameState.titleScreen;
            prevGameState = gameState;
            inputHandler = new InputHandler();

            plotScreen = new PlotScreen(this, musicPlayer, textures, fonts);
            level = new Level(this, textures, fonts, sounds, musicPlayer, plotScreen, new LevelLoader(config.LevelFiles), inputHandler);
            tutorial = new Level(this, textures, fonts, sounds, musicPlayer, null, new LevelLoader(config.TutorialFiles), inputHandler);
            gameOver = new GameOver(this, (Texture2D)textures[3], (SpriteFont)fonts[2], inputHandler);
            titleScreen = new TitleScreen(this, (Texture2D)textures[7], (Texture2D)textures[16], (SpriteFont)fonts[2], musicPlayer, inputHandler);
            titleMenu = new TitleMenu(this, (Texture2D)textures[7], (SpriteFont)fonts[2], inputHandler);
            levelIntroScreen = new LevelIntroScreen(this, (SpriteFont)fonts[1]);
            levelIntroScreen.InitLevelScreen(level.LevelName);

            credits = new Credits(this, (Texture2D)textures[creditsIndex], musicPlayer, fonts);

            playerAnimation = new PlayerAnimation(this, new Player(this, (Texture2D)textures[0], sounds, -100, 400));
            animatePlayer = false;

            int screenWidth = graphics.GraphicsDevice.Viewport.Width;
            int screenHeight = graphics.GraphicsDevice.Viewport.Height;

            //initializing virtual screen resolution to be mapped to the actual screen
            Resolution.Init(ref graphics);
            Resolution.SetVirtualResolution(screenWidth, screenHeight);
            Resolution.SetResolution(800, 600, true);
        }