示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            PresentationParameters pp = GraphicsDevice.PresentationParameters;

            renderer = new EffectRenderer(GraphicsDevice);
            renderer.AddLayer(BlendState.AlphaBlend, Content.Load <Effect>("basic"));
            renderer[0].Destination = new Rectangle(0, 0, pp.BackBufferWidth, pp.BackBufferHeight);
            renderer.AddLayer(BlendState.Additive);
            renderer[1].Destination = renderer[0].Destination;
            renderer.AddLayer(BlendState.AlphaBlend, Content.Load <Effect>("basic"));
            renderer[2].Destination = renderer[0].Destination;

            stateManager = new StateManager(this);
            Components.Add(stateManager);

            play     = new Play(this, renderer, stateManager);
            mainMenu = new MainMenu(this, renderer, stateManager);
            endState = new EndState(this, renderer, stateManager);

            stateManager.RegisterState(GameStateType.Playing, play);
            stateManager.RegisterState(GameStateType.MainMenu, mainMenu);
            stateManager.RegisterState(GameStateType.OptionsMenu, endState);

            stateManager.PushState(mainMenu);
            stateManager.Initialize();


            // TODO: use this.Content to load your game content here
        }