Ejemplo 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();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Se llama cada vez que hay que refrescar la pantalla.
        ///     Escribir aquí todo el código referido al renderizado.
        /// </summary>
        protected override void Draw(GameTime gameTime)
        {
            // Aca deberiaos poner toda la logia de renderizado del juego.
            //GraphicsDevice.Clear(Color.Black);

            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.BlendState        = BlendState.Opaque;

            GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1f, 0);

            // Set the main render target, here we'll draw the base scene
            //GraphicsDevice.SetRenderTarget(MainSceneRenderTarget);

            switch (status)
            {
            case ST_MENU:
                MenuUI.Draw(gameTime);
                break;

            case ST_LEVEL_1:
                //Lamp.Draw(gameTime);
                Map.Draw(gameTime);
                break;

            case ST_DEFEAT:
                DefeatUI.Draw(gameTime);
                break;

            case ST_WIN:
                WinUI.Draw(gameTime);
                break;
            }

            //Weapon.Draw(gameTime);

            // Set the render target as null, we are drawing into the screen now!
            //GraphicsDevice.SetRenderTarget(null);
            //GraphicsDevice.Clear(Color.Black);

            base.Draw(gameTime);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     Se llama una sola vez, al principio cuando se ejecuta el ejemplo.
        ///     Escribir aquí todo el código de inicialización: todo procesamiento que podemos pre calcular para nuestro juego.
        /// </summary>
        protected override void Initialize()
        {
            // La logica de inicializacion que no depende del contenido se recomienda poner en este metodo.
            IsMouseVisible = true;
            // Apago el backface culling.
            // Esto se hace por un problema en el diseno del modelo del logo de la materia.
            // Una vez que empiecen su juego, esto no es mas necesario y lo pueden sacar.
            var rasterizerState = new RasterizerState();

            rasterizerState.CullMode       = CullMode.CullCounterClockwiseFace;
            GraphicsDevice.RasterizerState = rasterizerState;
            // Seria hasta aca.

            MapRepo.CurrentMap = MapRepo.Level1(this, GraphicsDevice);
            Map = MapRepo.CurrentMap;
            Map.Initialize(this);
            MenuUI   = new MenuUI();
            DefeatUI = new DefeatUI();
            WinUI    = new WinUI();
            Lamp     = new Lamp(Matrix.CreateTranslation(1250, 0, 125));

            base.Initialize();
        }