Пример #1
0
 public void RenderizarExtras()//renderizar estas cosas luego de los shaders
 {
     physicsEngine.Render(Input);
     hud.Render();
     cues.Render();
     dynamicCueManager.Render();
     boundingBoxHelper.RenderBoundingBoxes();
 }
Пример #2
0
        /// <summary>
        ///     Dibujamos toda la escena pero en vez de a la pantalla, la dibujamos al Render Target que se cargo antes.
        ///     Es como si dibujaramos a una textura auxiliar, que luego podemos utilizar.
        /// </summary>
        private void drawSceneToRenderTarget(Microsoft.DirectX.Direct3D.Device d3dDevice)
        {
            //Arrancamos el renderizado. Esto lo tenemos que hacer nosotros a mano porque estamos en modo CustomRenderEnabled = true
            d3dDevice.BeginScene();

            //Dibujamos todos los meshes del escenario

            // Si se muestra menu principal
            if (presentacion)
            {
                drawer2D.BeginDrawSprite();

                //buttonUnselected.Position = new Vector2((D3DDevice.Instance.Width / 16) * 6, ((float)D3DDevice.Instance.Height / 4) * 1.5f);
                drawer2D.DrawSprite(menuPresentacion);

                buttonUnselected.Position = new Vector2(((float)D3DDevice.Instance.Width / 2) - 150, 210);
                drawer2D.DrawSprite(buttonUnselected);

                buttonUnselected.Position = new Vector2(((float)D3DDevice.Instance.Width / 2) - 150, 280);
                drawer2D.DrawSprite(buttonUnselected);

                buttonUnselected.Position = new Vector2(((float)D3DDevice.Instance.Width / 2) - 150, 350);
                drawer2D.DrawSprite(buttonUnselected);
                drawer2D.DrawSprite(buttonSelected);
                drawer2D.DrawSprite(logoWilson);

                drawer2D.EndDrawSprite();

                /*
                 *              textoMenuPppal[1] = "Menú Principal";
                 *              textoMenuPppal[2] = "Movimiento Personaje: W A S D";
                 *              textoMenuPppal[3] = "Comer (1), Beber (2), Usar Madera (3), Usar Piedra (4)";
                 *              textoMenuPppal[4] = "Acciones: Agarrar (E) - Destruir (Click Izq) - Correr (Shift Izq)";
                 *              textoMenuPppal[5] = "Modos: Normal (N) - God (G)";
                 *              textoMenuPppal[6] = "Pausa: ESC";
                 *              textoMenuPppal[7] = "Comenzar: Espacio";
                 *              textoMenuPppal[8] = "Salir: Alt+F4";
                 */

                textoMenuPppal[1] = "Menú Principal";
                textoMenuPppal[2] = "";
                textoMenuPppal[3] = "Comenzar ";
                textoMenuPppal[4] = "Reiniciar";
                textoMenuPppal[5] = "Salir    ";

                for (var j = 1; j <= 5; j++)
                {
                    if (j == 1)
                    {
                        DrawText.changeFont((new System.Drawing.Font("Tahoma", 35, FontStyle.Underline)));
                    }
                    else
                    {
                        DrawText.changeFont((new System.Drawing.Font("Tahoma", 35, FontStyle.Regular)));
                    }
                    DrawText.drawText(textoMenuPppal[j], (D3DDevice.Instance.Width / 2) - (textoMenuPppal[j].Length * 10) + 2, (70 * j) + 2, Color.Black);
                    DrawText.drawText(textoMenuPppal[j], (D3DDevice.Instance.Width / 2) - (textoMenuPppal[j].Length * 10), 70 * j, Color.OrangeRed);
                }

                textoMenuPppal[7] = "Acciones: Agarrar (E), Destruir (Click Izq), Correr (Shift)";
                textoMenuPppal[8] = "Interacción Inventario: Comer (1), Beber (2), Usar Madera (3), Usar Piedra (4)";
                textoMenuPppal[9] = "Modos del Juego: Normal (N) - God (G)";

                for (var j = 7; j <= 9; j++)
                {
                    DrawText.changeFont((new System.Drawing.Font("Tahoma", 25, FontStyle.Regular)));
                    DrawText.drawText(textoMenuPppal[j], (D3DDevice.Instance.Width / 2) - (textoMenuPppal[j].Length * 7) + 2, (68 * j) + 2 - 20, Color.Black);
                    DrawText.drawText(textoMenuPppal[j], (D3DDevice.Instance.Width / 2) - (textoMenuPppal[j].Length * 7), (68 * j) - 20, Color.BlueViolet);
                }

                textoMenuPppal[10] = "Objetivo: Sobrevivir en la Isla y pedir ayuda al exterior.";
                DrawText.drawText(textoMenuPppal[10], (D3DDevice.Instance.Width / 2) - (textoMenuPppal[10].Length * 7) + 2, (D3DDevice.Instance.Height - 70) + 2, Color.Black);
                DrawText.drawText(textoMenuPppal[10], (D3DDevice.Instance.Width / 2) - (textoMenuPppal[10].Length * 7), D3DDevice.Instance.Height - 70, Color.GreenYellow);

                if (Input.keyDown(Key.Space) || Input.keyDown(Key.Return))
                {
                    switch (opcionMenuSelecionado)
                    {
                    case 0:     // Comenzar Juego
                        presentacion = false;
                        break;

                    case 1:
                        presentacion = false;
                        Reiniciar();
                        break;

                    case 2:
                        Dispose();
                        //Program.Terminate();
                        break;
                    }

                    presentacion = false;
                }
            }
            else
            {
                if (Input.keyDown(Key.Escape))
                {
                    presentacion = true;
                }

                // Si se da la condicion de partido ganado
                if (partidoGanado)
                {
                    hud.ganarJuego();
                }
                else
                {
                    terreno.Render(ElapsedTime);

                    // Creo la fogata
                    if (terreno.activarFogata)
                    {
                        terreno.fogata.render();
                    }

                    //cajaMenu.render();
                    RenderHelpText();
                    personaje.Render(ElapsedTime);
                    RenderFPS();
                    RenderAxis();
                }

                hud.Render();
            }

            //Terminamos manualmente el renderizado de esta escena. Esto manda todo a dibujar al GPU al Render Target que cargamos antes
            d3dDevice.EndScene();
        }