Esempio n. 1
0
        /// <summary>
        ///     Se llama una sola vez, al principio cuando se ejecuta el ejemplo, despues de Initialize.
        ///     Escribir aqui el codigo de inicializacion: cargar modelos, texturas, estructuras de optimizacion, el
        ///     procesamiento que podemos pre calcular para nuestro juego.
        /// </summary>
        protected override void LoadContent()
        {
            // Load the base bloom pass effect
            //Effect = ContentManager.Instance.LoadEffect("Bloom");

            // Create a full screen quad to post-process
            //FullScreenQuad = new FullScreenQuad(GraphicsDevice);

            // Create render targets.
            // MainRenderTarget is used to store the scene color
            // BloomRenderTarget is used to store the bloom color and switches with MultipassBloomRenderTarget
            // depending on the pass count, to blur the bloom color

            /*
             * MainSceneRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width,
             *  GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 0,
             *  RenderTargetUsage.DiscardContents);
             * FirstPassBloomRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width,
             *  GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 0,
             *  RenderTargetUsage.DiscardContents);
             */
            Map.Load(GraphicsDevice);
            MenuUI.Load(GraphicsDevice);
            DefeatUI.Load(GraphicsDevice);
            WinUI.Load(GraphicsDevice);
            Lamp.Load();
            base.LoadContent();
        }
        public override void Load(GraphicsDevice gd)
        {
            GraphicsDevice = gd;

            IntegrateEffect = ContentManager.Instance.LoadEffect("Bloom");

            // Create a full screen quad to post-process
            FullScreenQuad = new FullScreenQuad(GraphicsDevice);

            // Load the blur effect to blur the bloom texture
            BlurEffect = ContentManager.Instance.LoadEffect("GaussianBlur");
            BlurEffect.Parameters["screenSize"]
            .SetValue(new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height));


            // Create render targets.
            // MainRenderTarget is used to store the scene color
            // BloomRenderTarget is used to store the bloom color and switches with MultipassBloomRenderTarget
            // depending on the pass count, to blur the bloom color
            MainSceneRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width,
                                                       GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 0,
                                                       RenderTargetUsage.DiscardContents);
            FirstPassBloomRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width,
                                                            GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 0,
                                                            RenderTargetUsage.DiscardContents);
            SecondPassBloomRenderTarget = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width,
                                                             GraphicsDevice.Viewport.Height, false, SurfaceFormat.Color, DepthFormat.None, 0,
                                                             RenderTargetUsage.DiscardContents);

            UI.Load(gd);

            Lamp.Load();

            Lamp2.Load();

            Player.Load();

            foreach (var room in Rooms)
            {
                room.Load();
            }

            foreach (var enemy in Enemies)
            {
                enemy.Load(gd);
            }
        }