public void Init(String MediaDir, Personaje _personaje) { personaje = _personaje; drawer = new Drawer2D(); var altoOriginal = 1017; var anchoOriginal = 1920; factorAncho = width / anchoOriginal; factorAlto = height / altoOriginal; BarraBateria = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\BarraBateria.png", D3DDevice.Instance.Device), Position = new TGCVector2(width * 0.02f, height * 0.85f), Scaling = new TGCVector2(0.5f * factorAncho, 0.5f * factorAlto), Color = Color.DarkMagenta, }; RellenoBateria = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\Bateria.png", D3DDevice.Instance.Device), Position = new TGCVector2(width * 0.045f, height * 0.85f), Scaling = new TGCVector2(5f * factorAncho, 5f * factorAlto), Color = Color.DarkGoldenrod, }; MenuControlesSprite = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\menuControles.png", D3DDevice.Instance.Device), Position = new TGCVector2(width * 0.32f, height * 0.20f), Scaling = new TGCVector2(0.6f * factorAncho, 0.6f * factorAlto), }; MapaPersonajeSprite = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\mapa.jpg", D3DDevice.Instance.Device), Position = new TGCVector2(width * 0.3f, height * 0.20f), Scaling = new TGCVector2(0.6f * factorAncho, 0.6f * factorAlto), }; EspacioMensajeSprite = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\EspacioMensaje.png", D3DDevice.Instance.Device), Position = new TGCVector2(width * 0.35f, height * 0.70f), }; AgendaSprite = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\EspacioPista.png", D3DDevice.Instance.Device), Position = new TGCVector2(width * 0.4f, height * 0.3f), Scaling = new TGCVector2(1.5f * factorAncho, 1.5f * factorAlto), }; mainMenuSprite = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\logo.png", D3DDevice.Instance.Device), Position = new TGCVector2(width * 0.28f, height * 0.02f), Scaling = new TGCVector2(0.8f * factorAncho, 0.5f * factorAlto), }; pantallaAzulSprite = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\BSODEndgame.png", D3DDevice.Instance.Device), Position = new TGCVector2(0f, 0f), Scaling = new TGCVector2(1.9f * factorAncho, 2f * factorAlto), }; GameOverSprite = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\GAMEOVER.png", D3DDevice.Instance.Device), Position = new TGCVector2(width / 8f, height / 5f), Scaling = new TGCVector2(0.4f * factorAncho, 0.4f * factorAlto), }; batroja = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\batroja.png", D3DDevice.Instance.Device), Position = new TGCVector2(width / 22f, height / 1.25f), Scaling = new TGCVector2(0.4f * factorAncho, 0.4f * factorAlto), }; batnaranja = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\batnaranja.png", D3DDevice.Instance.Device), Position = new TGCVector2(width / 22f, height / 1.25f), Scaling = new TGCVector2(0.4f * factorAncho, 0.4f * factorAlto), }; batamarilla = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\batamarilla.png", D3DDevice.Instance.Device), Position = new TGCVector2(width / 22f, height / 1.25f), Scaling = new TGCVector2(0.4f * factorAncho, 0.4f * factorAlto), }; batverde = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\batverde.png", D3DDevice.Instance.Device), Position = new TGCVector2(width / 22f, height / 1.25f), Scaling = new TGCVector2(0.4f * factorAncho, 0.4f * factorAlto), }; espaciosInventario = new List <EspacioObjeto>(); espaciosPiezas = new List <EspacioObjeto>(); CustomSprite spriteActual; float y0 = height * 0.10f; float x0 = 0; float dy = 60 * factorAlto; float dx = 0; for (int i = 0; i < MAXIMO_ITEMS; i++) { y0 = y0 + dy; spriteActual = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\EspacioObjeto.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, y0), Scaling = new TGCVector2(factorAncho, factorAlto), }; espaciosInventario.Add(new EspacioObjeto(spriteActual)); } y0 = height * 0.05f; x0 = width * 0.80f; dy = 80 * factorAlto; dx = 80 * factorAncho; for (int j = 0; j < 3; j++) { for (int i = 0; i < MAXIMO_PIEZAS / 3; i++) { x0 = x0 + dx; spriteActual = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\2D\\EspacioObjeto.png", D3DDevice.Instance.Device), Position = new TGCVector2(x0, y0), Scaling = new TGCVector2(1.2f * factorAncho, 1.2f * factorAlto), }; espaciosPiezas.Add(new EspacioObjeto(spriteActual)); } y0 = y0 + dy; x0 = width * 0.80f; } }
public Boton(CustomBitmap sprite, CustomBitmap spriteSelec, string texto, int indice, Drawer2D drawer) { CustomSprite menuSprite = new CustomSprite(); menuSprite.Bitmap = sprite; CustomSprite menuSpriteSelec = new CustomSprite(); menuSpriteSelec.Bitmap = spriteSelec; menuItem = new HUDSprite(HUD.AnclajeHorizontal.LEFT, HUD.AnclajeVertical.TOP, new TGCVector2(0.05f, 0.5f + (float)indice / 17), new TGCVector2(1, 1), drawer, menuSprite); menuItemSelec = new HUDSprite(HUD.AnclajeHorizontal.LEFT, HUD.AnclajeVertical.TOP, new TGCVector2(0.05f, 0.5f + (float)indice / 17), new TGCVector2(1, 1), drawer, menuSpriteSelec); menuItem.Init(); menuItemSelec.Init(); TgcText2D texto2D = new TgcText2D(); texto2D.Align = TgcText2D.TextAlign.CENTER; texto2D.Size = new Size((int)(menuItem.Sprite.Scaling.X * 350), 20); texto2D.changeFont(new System.Drawing.Font("Calibri", D3DDevice.Instance.Width / 96f, FontStyle.Italic | FontStyle.Bold)); texto2D.Text = texto; this.texto = new HUDTexto(HUD.AnclajeHorizontal.LEFT, HUD.AnclajeVertical.TOP, new TGCVector2(0.1f, 0.5175f + (float)indice / 17), drawer, texto2D); this.texto.Init(); }
public GUI(String mediaDir, D3DDevice device, Player player, GameModel gameModel) { Device = device; Player1 = player; gameModelInstance = gameModel; gameOverSpriteLocation = mediaDir + "2d\\gui\\gameover.png"; drawer = new Drawer2D(); statusBarContent = new Dictionary <StatusBarElements, TgcText2D>(); //armo sprite de selección Vector2 scaling = new Vector2(0.35f, 0.35f); itemSelectionSprite = null; itemSelectionSprite = new CustomSprite(); itemSelectionSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\items\\selection.png", Device.Device); itemSelectionSprite.Scaling = scaling; itemCombinationSprite = null; itemCombinationSprite = new CustomSprite(); itemCombinationSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\items\\combination.png", Device.Device); itemCombinationSprite.Scaling = scaling; itemEquippedSprite = null; itemEquippedSprite = new CustomSprite(); itemEquippedSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\items\\equipped.png", Device.Device); itemEquippedSprite.Scaling = scaling; //creo sprites para cada tipo de objeto foreach (InventoryObject.ObjectTypes type in Enum.GetValues(typeof(InventoryObject.ObjectTypes))) { CustomSprite sprite = null; sprite = new CustomSprite(); sprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\items\\" + type.ToString() + ".png", Device.Device); sprite.Scaling = scaling; //agrego objetos a la lista InventorySprites.Add(type, sprite); } //creo sprites para cada tipo de clima foreach (World.Weather weather in Enum.GetValues(typeof(World.Weather))) { CustomSprite sprite = null; sprite = new CustomSprite(); sprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\weather_" + weather.ToString() + ".png", Device.Device); sprite.Scaling = new Vector2(0.35f, 0.35f); //agrego objetos a la lista WeatherSprites.Add(weather, sprite); } //fecha y hora //contabilizo texto fps usedSpace += (int)(DefaultFontSize * 1.1f); dayTime = GameUtils.createText("", 0, usedSpace); //barras de status hpBarSprite = new CustomSprite(); hpBarSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\hp-bar.png", Device.Device); hpBarSprite.Position = new Vector2(Device.Width - (hpBarSprite.Bitmap.Width * hpBarSprite.Scaling.X), Device.Height - (hpBarSprite.Bitmap.Height * 1.05f)); hpBarFrameSprite = new CustomSprite(); hpBarFrameSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\frame-hp-bar.png", Device.Device); hpBarFrameSprite.Position = new Vector2(Device.Width - (hpBarSprite.Bitmap.Width * hpBarSprite.Scaling.X), Device.Height - (hpBarSprite.Bitmap.Height * 1.05f)); hungerBarSprite = new CustomSprite(); hungerBarSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\hunger-bar.png", Device.Device); hungerBarSprite.Position = new Vector2(Device.Width - (hungerBarSprite.Bitmap.Width * hungerBarSprite.Scaling.X), hpBarSprite.Position.Y - (hungerBarSprite.Bitmap.Height * 1.05f)); hungerBarFrameSprite = new CustomSprite(); hungerBarFrameSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\frame-hunger-bar.png", Device.Device); hungerBarFrameSprite.Position = new Vector2(Device.Width - (hungerBarSprite.Bitmap.Width * hungerBarSprite.Scaling.X), hpBarSprite.Position.Y - (hungerBarSprite.Bitmap.Height * 1.05f)); thirstBarSprite = new CustomSprite(); thirstBarSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\thirst-bar.png", Device.Device); thirstBarSprite.Position = new Vector2(Device.Width - (thirstBarSprite.Bitmap.Width * thirstBarSprite.Scaling.X), hungerBarSprite.Position.Y - (thirstBarSprite.Bitmap.Height * 1.05f)); thirstBarFrameSprite = new CustomSprite(); thirstBarFrameSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\frame-thirst-bar.png", Device.Device); thirstBarFrameSprite.Position = new Vector2(Device.Width - (thirstBarSprite.Bitmap.Width * thirstBarSprite.Scaling.X), hungerBarSprite.Position.Y - (thirstBarSprite.Bitmap.Height * 1.05f)); staminaBarSprite = new CustomSprite(); staminaBarSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\stamina-bar.png", Device.Device); staminaBarSprite.Position = new Vector2(Device.Width - (staminaBarSprite.Bitmap.Width * staminaBarSprite.Scaling.X), thirstBarSprite.Position.Y - (staminaBarSprite.Bitmap.Height * 1.05f)); staminaBarFrameSprite = new CustomSprite(); staminaBarFrameSprite.Bitmap = new CustomBitmap(mediaDir + "2d\\gui\\frame-stamina-bar.png", Device.Device); staminaBarFrameSprite.Position = new Vector2(Device.Width - (staminaBarSprite.Bitmap.Width * staminaBarSprite.Scaling.X), thirstBarSprite.Position.Y - (staminaBarSprite.Bitmap.Height * 1.05f)); foreach (World.Weather weather in Enum.GetValues(typeof(World.Weather))) { CustomSprite sprite = WeatherSprites[weather]; sprite.Position = new Vector2(Device.Width - sprite.Bitmap.Width / 2.5f, staminaBarSprite.Position.Y - (sprite.Bitmap.Height)); } }
public override void Init() { //Para la creacion de checkpoints, borrar en el futuro System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; Clipboard.Clear(); this.inicializarCamara(); //Seteo el personaje seteoDePersonaje(); //Seteo del monsturo seteoDelMonstruo(); //Seteo el escenario escenario = new TgcSceneLoader().loadSceneFromFile(MediaDir + "Mapa\\mapaProjectMarble-TgcScene.xml"); //initPuertaGiratoria(); //Almacenar volumenes de colision del escenario objetosColisionables.Clear(); CollisionManager.obstaculos = new List <BoundingBoxCollider>(); foreach (var mesh in escenario.Meshes) { if (mesh.Name.Contains("Recarga")) { BoundingBoxCollider recarga = BoundingBoxCollider.fromBoundingBox(mesh.BoundingBox); string[] nombre = Regex.Split(mesh.Name, "-"); recarga.nombre = nombre[1]; recarga.mesh = mesh; objetosRecarga.Add(recarga); } else { if (mesh.Name.Contains("Puerta")) { mesh.AutoTransformEnable = true; BoundingBoxCollider puerta = BoundingBoxCollider.fromBoundingBox(mesh.BoundingBox); puertas.Add(puerta); } if (mesh.Name.Contains("Placard") || mesh.Name.Contains("Locker")) { armarios.Add(BoundingBoxCollider.fromBoundingBox(mesh.BoundingBox)); } BoundingBoxCollider obj = BoundingBoxCollider.fromBoundingBox(mesh.BoundingBox); obj.nombre = mesh.Name; objetosColisionables.Add(obj); CollisionManager.obstaculos.Add(BoundingBoxCollider.fromBoundingBox(mesh.BoundingBox)); } meshEscenario.Add(mesh); } CheckpointHelper.BuildCheckpoints(); DestinoMonstruo = CheckpointHelper.checkpoints[0]; //Crear manejador de colisiones collisionManager = new ElipsoidCollisionManager(); collisionManager.SlideFactor = 2; collisionManager.GravityEnabled = false; colisionadorMonstruo = new ElipsoidCollisionManager(); colisionadorMonstruo.SlideFactor = 2; colisionadorMonstruo.GravityEnabled = false; drawer2D = new Drawer2D(); this.incializarMenu(); inicializarPantallaNegra(); mp3Player = new TgcMp3Player(); inicializarBarra(); iniciliazarAlarma(); incializarVisionNoctura(); luz = new Linterna(); }
/// <summary> /// Se llama una sola vez, al principio cuando se ejecuta el ejemplo. /// Escribir aquí todo el código de inicialización: cargar modelos, texturas, estructuras de optimización, todo /// procesamiento que podemos pre calcular para nuestro juego. /// Borrar el codigo ejemplo no utilizado. /// </summary> public override void Init() { estrellasS.ForEach(e => e.AutoTransform = true); CustomVertex.PositionTextured[] screenQuadVertices = { new CustomVertex.PositionTextured(-1, 1, 1, 0, 0), new CustomVertex.PositionTextured(1, 1, 1, 1, 0), new CustomVertex.PositionTextured(-1, -1, 1, 0, 1), new CustomVertex.PositionTextured(1, -1, 1, 1, 1) }; //vertex buffer de los triangulos screenQuadVB = new VertexBuffer(typeof(CustomVertex.PositionTextured), 4, D3DDevice.Instance.Device, Usage.Dynamic | Usage.WriteOnly, CustomVertex.PositionTextured.Format, Pool.Default); screenQuadVB.SetData(screenQuadVertices, 0, LockFlags.None); //Creamos un DepthStencil que debe ser compatible con nuestra definicion de renderTarget2D. depthStencil = D3DDevice.Instance.Device.CreateDepthStencilSurface(D3DDevice.Instance.Device.PresentationParameters.BackBufferWidth, D3DDevice.Instance.Device.PresentationParameters.BackBufferHeight, DepthFormat.D24S8, MultiSampleType.None, 0, true); depthStencilOld = D3DDevice.Instance.Device.DepthStencilSurface; escena = new Texture(D3DDevice.Instance.Device, D3DDevice.Instance.Device.PresentationParameters.BackBufferWidth, D3DDevice.Instance.Device.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); propulsores = new Texture(D3DDevice.Instance.Device, D3DDevice.Instance.Device.PresentationParameters.BackBufferWidth, D3DDevice.Instance.Device.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); propulsoresBlurAux = new Texture(D3DDevice.Instance.Device, D3DDevice.Instance.Device.PresentationParameters.BackBufferWidth, D3DDevice.Instance.Device.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); propulsoresBlurAux2 = new Texture(D3DDevice.Instance.Device, D3DDevice.Instance.Device.PresentationParameters.BackBufferWidth, D3DDevice.Instance.Device.PresentationParameters.BackBufferHeight, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); //Device de DirectX para crear primitivas. var d3dDevice = D3DDevice.Instance.Device; D3DDevice.Instance.Device.Transform.Projection = Matrix.PerspectiveFovLH(D3DDevice.Instance.FieldOfView, D3DDevice.Instance.AspectRatio, D3DDevice.Instance.ZNearPlaneDistance, D3DDevice.Instance.ZFarPlaneDistance * 1.8f); this.postProcessMerge = TgcShaders.loadEffect(this.ShadersDir + "PostProcess.fx"); this.blurEffect = TgcShaders.loadEffect(this.ShadersDir + "GaussianBlur.fx"); blurEffect.SetValue("screen_dx", d3dDevice.PresentationParameters.BackBufferWidth); blurEffect.SetValue("screen_dy", d3dDevice.PresentationParameters.BackBufferHeight); this.escenarios = new List <Escenario>(); this.enemigos = new List <NaveEnemiga>(); //Crear SkyBox skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 0, -2300f); skyBox.Size = new TGCVector3(10000, 10000, 18000); var texturesPath = MediaDir + "XWing\\Textures\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "space.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "space.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "space.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "space.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "space.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "space.jpg"); skyBox.Init(); this.navePrincipal = new NaveEspacial(MediaDir, "xwing-TgcScene.xml", Color.DarkBlue, 10, 250, null, 250f); this.navePrincipal.ScaleFactor = TGCMatrix.Scaling(0.5f, 0.5f, 0.5f); this.navePrincipal.RotationVector = new TGCVector3(0, FastMath.PI_HALF, 0); this.navePrincipal.MovementVector = new TGCVector3(1200f, -1100f, 4000f); for (int i = 0; i < 5; i++) { escenarios.Add(Escenario.GenerarEscenarioDefault(MediaDir, i)); } for (int i = 0; i < enemigosAlMismoTiempo; i++) { enemigos.Add(new NaveEnemiga(MediaDir, "X-Wing-TgcScene.xml", dañoEnemigos, 500, navePrincipal)); enemigos[i].MovementVector = new TGCVector3(0, 0, 500000000000f); enemigos[i].CreateOOB(); } //escenarios.ForEach(es => es.generarTorre(MediaDir)); currentScene = escenarios[0]; this.navePrincipal.CreateOOB(); //Suelen utilizarse objetos que manejan el comportamiento de la camara. //Lo que en realidad necesitamos gráficamente es una matriz de View. //El framework maneja una cámara estática, pero debe ser inicializada. //Posición de la camara. var cameraPosition = new TGCVector3(0, 0, 0); //Quiero que la camara mire hacia el origen (0,0,0). var lookAt = new TGCVector3(-50000, -1, 0); //Configuro donde esta la posicion de la camara y hacia donde mira. Camara.SetCamera(cameraPosition, lookAt); //Internamente el framework construye la matriz de view con estos dos vectores. //Luego en nuestro juego tendremos que crear una cámara que cambie la matriz de view con variables como movimientos o animaciones de escenas. Camara = new CamaraStarWars(this.navePrincipal.GetPosition(), 20, 100); sol = TGCBox.fromSize(new TGCVector3(0, 5000, 4000), new TGCVector3(50, 50, 50), Color.Yellow); sol.AutoTransform = true; menu = new Menu(MediaDir, Input); //Cargo sonidos pathSonidoMenu = MediaDir + "Sound\\musica_menu.mp3"; pathSonidoAmbiente = MediaDir + "Music\\StarWarsMusic.mp3"; pathSonidoDisparo = MediaDir + "Music\\laserSound.wav"; if (menu.playSonidoMenu) { playerAmbiente.closeFile(); playerAmbiente.FileName = pathSonidoMenu; playerAmbiente.play(true); } drawer = new Drawer2D(); hud = new Hud(MediaDir, Input); //ShadowMap // Creo el shadowmap. // Format.R32F // Format.X8R8G8B8 g_pShadowMap = new Texture(D3DDevice.Instance.Device, SHADOWMAP_SIZE, SHADOWMAP_SIZE, 1, Usage.RenderTarget, Format.R32F, Pool.Default); // tengo que crear un stencilbuffer para el shadowmap manualmente // para asegurarme que tenga la el mismo tamano que el shadowmap, y que no tenga // multisample, etc etc. g_pDSShadow = D3DDevice.Instance.Device.CreateDepthStencilSurface(SHADOWMAP_SIZE, SHADOWMAP_SIZE, DepthFormat.D24S8, MultiSampleType.None, 0, true); // por ultimo necesito una matriz de proyeccion para el shadowmap, ya // que voy a dibujar desde el pto de vista de la luz. // El angulo tiene que ser mayor a 45 para que la sombra no falle en los extremos del cono de luz // de hecho, un valor mayor a 90 todavia es mejor, porque hasta con 90 grados es muy dificil // lograr que los objetos del borde generen sombras var aspectRatio = D3DDevice.Instance.AspectRatio; g_mShadowProj = TGCMatrix.PerspectiveFovLH(Geometry.DegreeToRadian(50), aspectRatio, 50, 15000); D3DDevice.Instance.Device.Transform.Projection = TGCMatrix.PerspectiveFovLH(Geometry.DegreeToRadian(45.0f), aspectRatio, near_plane, far_plane).ToMatrix(); }
public Hud(string mediaDir, AutoManejable[] jugadores) { MediaDir = mediaDir; Jugadores = jugadores; Inicio = new Drawer2D(); PantallaInicioFondo = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\InicioFondo.jpg", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; PantallaInicioMenu = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\InicioMenu.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; PantallaInicioControles = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\InicioControles.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; EscalaInicioAltura = (float)D3DDevice.Instance.Height / (float)PantallaInicioFondo.Bitmap.Size.Height; EscalaInicioAncho = (float)D3DDevice.Instance.Width / (float)PantallaInicioFondo.Bitmap.Size.Width; TGCVector2 escalaInicio = new TGCVector2(EscalaInicioAncho, EscalaInicioAltura); PantallaInicioFondo.Scaling = escalaInicio; PantallaInicioMenu.Scaling = escalaInicio; PantallaInicioControles.Scaling = escalaInicio; ///// HUD ///// Huds = new Drawer2D(); Barra1 = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\Barra1.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; Barra2 = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\Barra2.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; Pausa = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\Pausa.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; Alarma = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\Alarma.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; VelocimetroFondo = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\VelocimetroFondo.png", D3DDevice.Instance.Device), }; VelocimetroAguja = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\VelocimetroAguja.png", D3DDevice.Instance.Device), }; BarraVida = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\BarraVida.png", D3DDevice.Instance.Device), }; Vida = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\Vida.png", D3DDevice.Instance.Device), }; ChapaInvisibilidad = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\ChapaInvisibilidad.png", D3DDevice.Instance.Device), }; Invisible = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\Invisible.png", D3DDevice.Instance.Device), }; EscalaVelocimetro = 0.25f * D3DDevice.Instance.Height / VelocimetroFondo.Bitmap.Size.Height; TGCVector2 escalaVelocimetroVector = new TGCVector2(EscalaVelocimetro, EscalaVelocimetro); VelocimetroFondo.Scaling = escalaVelocimetroVector; VelocimetroAguja.Scaling = escalaVelocimetroVector; BarraVida.Scaling = escalaVelocimetroVector; ChapaInvisibilidad.Scaling = escalaVelocimetroVector; Invisible.Scaling = escalaVelocimetroVector; VelocimetroAguja.RotationCenter = new TGCVector2(VelocimetroAguja.Bitmap.Size.Height * EscalaVelocimetro / 2, VelocimetroAguja.Bitmap.Size.Height * EscalaVelocimetro / 2); Barra1.Scaling = escalaInicio; Barra2.Scaling = escalaInicio; Pausa.Scaling = escalaInicio; Alarma.Scaling = escalaInicio; GameOver = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\GameOver.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; GanadorJ1 = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\GanadorJ1.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; GanadorJ2 = new CustomSprite { Bitmap = new CustomBitmap(MediaDir + "\\Imagenes\\GanadorJ2.png", D3DDevice.Instance.Device), Position = new TGCVector2(0, 0) }; GameOver.Scaling = escalaInicio; GanadorJ1.Scaling = escalaInicio; GanadorJ2.Scaling = escalaInicio; HudTiempo = new TgcText2D { Color = Color.WhiteSmoke, Position = new Point(0, 50) }; HudTiempo.changeFont(new System.Drawing.Font("DS-Digital", 90)); TiempoF = new TgcText2D { Color = Color.FromArgb(125, 1, 1, 1), Position = new Point(0, (int)((float)D3DDevice.Instance.Height * 0.57f)) }; TiempoF.changeFont(new System.Drawing.Font("DS-Digital", 90)); TiempoFF = new TgcText2D { Color = Color.FromArgb(1, 1, 1), Position = new Point(2, ((int)((float)D3DDevice.Instance.Height * 0.57f)) - 2) }; TiempoFF.changeFont(new System.Drawing.Font("DS-Digital", 90)); }