Esempio n. 1
0
        public override void render(float elapsedTime)
        {
            #region CAMBIO DE RENDER TARGET
            Postproceso.CambiarRenderState();

            Microsoft.DirectX.Direct3D.Device d3dDevice = GuiController.Instance.D3dDevice;

            d3dDevice.Clear(ClearFlags.ZBuffer | ClearFlags.Target, Color.Black, 1.0f, 0);

            // pongo los rendering states
            d3dDevice.RenderState.ZBufferEnable      = true;
            d3dDevice.RenderState.ZBufferWriteEnable = true;
            d3dDevice.RenderState.ZBufferFunction    = Compare.LessEqual;
            d3dDevice.RenderState.AlphaBlendEnable   = true;
            #endregion

            InputManager.ManejarInput();

            InteractionManager.UpdateElementos();

            InteractionManager.RenderElementos();

            setUsersVars();
            renderizar();

            GuiController.Instance.FpsCounterEnable = true;
            Postproceso.RenderPostProcesado();
            // Volver a dibujar FPS
            GuiController.Instance.Text3d.drawText("FPS: " + HighResolutionTimer.Instance.FramesPerSecond, 0, 0, Color.Yellow);
            GuiController.Instance.AxisLines.render();

            coordenadasMouse();
        }
Esempio n. 2
0
        public override void init()
        {
            #region INICIALIZACIONES ESCENARIO

            lightMesh = TgcBox.fromSize(new Vector3(10, 10, 10), Color.Red);
            oceano    = new Oceano(currentScaleXZ, currentScaleY);
            isla      = new Isla(currentScaleXZ, currentScaleY);
            skyBox    = new PirateSkyBox();

            #endregion

            #region INICIALIZACIONES PANTALLA

            crearModifiers();

            crearUserVars();
            crearSprites();
            // Carga valores para el postprocesado
            Postproceso.Cargar();

            #endregion

            #region INICIALIZACIONES BARCO

            barcoProtagonista = ConstructorDeElementos.ConstruirProtagonista(new Vector2(0, -930f));
            b1 = ConstructorDeElementos.ConstruirEnemigo(new Vector2(500, 500));
            b2 = ConstructorDeElementos.ConstruirEnemigo(new Vector2(-700, 960));
            b3 = ConstructorDeElementos.ConstruirEnemigo(new Vector2(100, 880));

            InteractionManager.Barcos.AddRange(new List <Barco> {
                b1, b2, b3, barcoProtagonista
            });
            InteractionManager.Resto.AddRange(new List <IUpdateRender> {
                isla, oceano
            });

            InputManager.Add(barcoProtagonista);

            #endregion
        }