/// <summary>
 /// Load all content.
 /// </summary>
 public override void LoadContent()
 {
     // retrieve the audio manager, done here in lieu of Initialize
     audioManager = (AudioManager)ScreenManager.Game.Services.GetService(
                                                         typeof(AudioManager));
     base.LoadContent();
 }
Example #2
0
        public VectorRumbleGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            #if WINDOWS_PHONE || IOS || ANDROID // WP7, iPad or Tablets only
            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 480;
            graphics.IsFullScreen = true;
            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;
            TouchPanel.EnabledGestures = GestureType.Tap;
            #else
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;
            #endif
            graphics.SynchronizeWithVerticalRetrace = true;

            // create the screen manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            // create the audio manager
            audioManager = new AudioManager(this,
                "Content/Audio/VectorRumble.xgs",
                "Content/Audio/VectorRumble.xwb",
                "Content/Audio/VectorRumble.xsb");
            Services.AddService(typeof(AudioManager), audioManager);
        }
        /// <summary>
        /// Initialize the game, after the ScreenManager is set, but not every time
        /// the graphics are reloaded.
        /// </summary>
        public void Initialize()
        {
            // create and add the bloom effect
            bloomComponent = new BloomComponent(ScreenManager.Game);
            ScreenManager.Game.Components.Add(bloomComponent);
            // do not automatically draw the bloom component
            bloomComponent.Visible = false;

            // create the world
            world = new World(new Vector2(ScreenManager.GraphicsDevice.Viewport.Width,
                ScreenManager.GraphicsDevice.Viewport.Height));

            // retrieve the audio manager
            audio = (AudioManager)ScreenManager.Game.Services.GetService(
                typeof(AudioManager));
            world.AudioManager = audio;

            // start up the music
            audio.PlayMusic("gameMusic");

            // start up the game
            world.StartNewGame();
            gameOver = false;
        }