Example #1
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);
        }
Example #2
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();
        }