/// <summary> /// crea un texto con el valor indicado, la configuración por defecto y la posición indicada /// </summary> /// <param name="value"></param> /// <returns></returns> public static TgcText2D createText(String value, float x, float y, int fontSize, bool bold) { TgcText2D text = createText(value, x, y); text.changeFont(new Font(FontFamily.GenericMonospace, fontSize, (bold? FontStyle.Bold : FontStyle.Regular))); return(text); }
public override void Init() { BackgroundColor = Color.Black; text = new TgcText2D(); text.Text = ""; text.Align = TgcText2D.TextAlign.RIGHT; text.Position = new Point(50, 75); text.Size = new Size(300, 100); text.Color = Color.Green; var ipHostInfo = Dns.GetHostEntry(Dns.GetHostName()); var localEP = new IPEndPoint(ipHostInfo.AddressList[0], 4444); listener = new Socket(localEP.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); listener.Blocking = false; listener.Bind(localEP); listener.Listen(32); clients = new List <Socket>(); /* * BinaryFormatter f = new BinaryFormatter(); * MemoryStream stream = new MemoryStream(); * f.Serialize(stream, new object()); * listener.Send(stream.ToArray()); */ }
public EscenaControles(TgcCamera Camera, string MediaDir, string ShadersDir, TgcText2D DrawText, float TimeBetweenUpdates, TgcD3dInput Input) : base(Camera, MediaDir, ShadersDir, DrawText, TimeBetweenUpdates, Input) { TgcScene escena = new TgcSceneLoader().loadSceneFromFile(MediaDir + "Cancha-TgcScene.xml"); pasto = new Pasto(escena.Meshes[0], TGCShaders.Instance.LoadEffect(ShadersDir + "CustomShaders.fx"), 32, .5f); paredes = escena.getMeshByName("Box_5"); Camera.SetCamera(new TGCVector3(20, 10, -20), new TGCVector3(0, 5, -7)); skyBox = new TgcSkyBox(); skyBox.Center = new TGCVector3(0, 500, 0); skyBox.Size = new TGCVector3(10000, 10000, 10000); var texturesPath = MediaDir + "Textures\\SkyBox LostAtSeaDay\\"; skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Up, texturesPath + "lostatseaday_up.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Down, texturesPath + "lostatseaday_dn.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Left, texturesPath + "lostatseaday_lf.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Right, texturesPath + "lostatseaday_rt.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Front, texturesPath + "lostatseaday_bk.jpg"); skyBox.setFaceTexture(TgcSkyBox.SkyFaces.Back, texturesPath + "lostatseaday_ft.jpg"); skyBox.Init(); unSprite = new CustomSprite(); unSprite.Bitmap = new CustomBitmap(MediaDir + "Textures\\Controles2.png", D3DDevice.Instance.Device); //unSprite.Scaling = new TGCVector2(unSprite.Bitmap.Width, unSprite.Bitmap.Height); unSprite.Position = new TGCVector2((float)D3DDevice.Instance.Width / 2 - unSprite.Bitmap.Width / 2, (float)D3DDevice.Instance.Height / 2 - unSprite.Bitmap.Height / 2); }
public override void Init() { //Cargar mesh var loader = new TgcSceneLoader(); mesh = loader.loadSceneFromFile(MediaDir + "ModelosTgc\\LogoTGC\\LogoTGC-TgcScene.xml").Meshes[0]; mesh.AutoTransformEnable = true; //Cargar Shader de PhongShading mesh.Effect = TgcShaders.Instance.TgcMeshPhongShader; mesh.Technique = TgcShaders.Instance.getTgcMeshTechnique(mesh.RenderType); //Texto help textHelp = new TgcText2D(); textHelp.Position = new Point(15, 260); textHelp.Size = new Size(500, 100); textHelp.changeFont(new Font("TimesNewRoman", 16, FontStyle.Regular)); textHelp.Color = Color.Yellow; textHelp.Align = TgcText2D.TextAlign.LEFT; textHelp.Text = "��Por donde empezar? Presionar \"H\""; //Help form var helpRtf = File.ReadAllText(MediaDir + "\\help.rtf"); helpForm = new EjemploDefaultHelpForm(helpRtf); //Camara Camara = new TgcRotationalCamera(new Vector3(), 150f, Input); }
public PrincipalMenu(Subnautica gameInstance) : base() { input = gameInstance.Input; this.gameInstance = gameInstance; bitmapSlotBackground = new CustomBitmap(Game.Default.MediaDirectory + "craftingSlotBackground.jpg", D3DDevice.Instance.Device); background = new CustomSprite(Game.Default.MediaDirectory + "blackSquare.jpg"); background.Color = Color.FromArgb(80, 0, 0, 0); // para la transparencia background.SrcRect = new Rectangle(0, 0, D3DDevice.Instance.Width, D3DDevice.Instance.Height); background.Position = TGCVector2.Zero; wasdSprite = new CustomSprite(gameInstance.MediaDir + "Sprites//WASD.png"); wasdSprite.SrcRect = new Rectangle(0, 0, D3DDevice.Instance.Width, D3DDevice.Instance.Height); wasdSprite.Position = new TGCVector2(D3DDevice.Instance.Width / 8, D3DDevice.Instance.Height / 2.5f); escISprite = new CustomSprite(gameInstance.MediaDir + "Sprites//EscI.png"); escISprite.SrcRect = new Rectangle(0, 0, D3DDevice.Instance.Width, D3DDevice.Instance.Height); escISprite.Position = new TGCVector2(D3DDevice.Instance.Width / 2.7f, D3DDevice.Instance.Height / 2.5f); mouseSprite = new CustomSprite(gameInstance.MediaDir + "Sprites//Mouse.png"); mouseSprite.SrcRect = new Rectangle(0, 0, D3DDevice.Instance.Width, D3DDevice.Instance.Height); mouseSprite.Position = new TGCVector2(D3DDevice.Instance.Width / 1.5f, D3DDevice.Instance.Height / 2f); titleText = new TgcText2D(); titleText.Text = "Tgcito se va de buceo"; titleText.changeFont(new Font("TimesNewRoman", 50, FontStyle.Bold)); titleText.Align = TgcText2D.TextAlign.CENTER; titleText.Position = new Point(0, D3DDevice.Instance.Height / 6); titleText.Color = Color.AntiqueWhite; UpdateSlotDisplay(); }
private void InitFonts() { DrawTextBig = new TgcText2D(); DrawTextSmall = new TgcText2D(); DrawTextBig.changeFont(new System.Drawing.Font("Arial Black", 40f)); DrawTextSmall.changeFont(new System.Drawing.Font("Arial Black", 25f)); }
public override void Init() { //Texto para el sonido actual currentSoundText = new TgcText2D(); currentSoundText.Text = "No sound"; currentSoundText.Position = new Point(50, 20); currentSoundText.Color = Color.Gold; currentSoundText.changeFont(new Font(FontFamily.GenericMonospace, 16, FontStyle.Italic)); //Texto de instrucciones instruccionesText = new TgcText2D(); instruccionesText.Text = "Y = Play, O = Stop."; instruccionesText.Position = new Point(50, 60); instruccionesText.Color = Color.Green; instruccionesText.changeFont(new Font(FontFamily.GenericMonospace, 16, FontStyle.Bold)); //Modifier para archivo MP3 currentFile = null; wavFileModifier = AddFile("WAV-File", MediaDir + "Sound\\campanadas horas.wav", "WAVs|*.wav"); //Modifier para loop playLoopModifier = AddBoolean("PlayLoop", "Play Loop", false); var filePath = wavFileModifier.Value; loadSound(filePath); }
/// <summary> /// crea un texto con el valor indicado, la configuración por defecto y la posición indicada /// </summary> /// <param name="value"></param> /// <returns></returns> public static TgcText2D createText(String value, float x, float y) { TgcText2D text = createText(value); text.Position = new Point((int)x, (int)y); return(text); }
public Menu(TgcD3dInput Input, String Titulo, FontFamily fontFamily) : base(Input) { this.mBotones = new List <Button>(); this.Titulo = Titulo; this.drawText = new TgcText2D(); this.drawText.changeFont(new Font(fontFamily, 50, FontStyle.Regular)); }
public void CargarHud() { //Device de DirectX para crear primitivas. var d3dDevice = D3DDevice.Instance.Device; var viewport = D3DDevice.Instance.Device.Viewport; TexturaVidas = TextureLoader.FromFile(d3dDevice, MediaDir + "\\sprites\\vida.png"); TexturaDuraznos = TextureLoader.FromFile(d3dDevice, MediaDir + "\\sprites\\durazno.png"); textoVidas = new TgcText2D(); textoVidas.Position = new Point(viewport.Width - 96, 0); textoVidas.Size = new Size(64, 32); textoVidas.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold)); textoVidas.Color = Color.Yellow; textoVidas.Align = TgcText2D.TextAlign.RIGHT; textoVidas.Text = personaje.Vidas.ToString(); textoDuraznos = new TgcText2D(); textoDuraznos.Position = new Point(viewport.Width - 96, 64); textoDuraznos.Size = new Size(64, 32); textoDuraznos.changeFont(new System.Drawing.Font("TimesNewRoman", 23, FontStyle.Bold)); textoDuraznos.Color = Color.Yellow; textoDuraznos.Align = TgcText2D.TextAlign.RIGHT; textoDuraznos.Text = personaje.Duraznos.ToString(); }
public override void Init() { int W = D3DDevice.Instance.Width; int H = D3DDevice.Instance.Height; collectedItems = new List <ItemModel>(); text = new TgcText2D(); text.Text = "INVENTARIO"; text.Color = Color.White; text.Align = TgcText2D.TextAlign.RIGHT; text.Position = new Point(300, 40); text.Size = new Size(300, 100); text.changeFont(new Font("TimesNewRoman", 25, FontStyle.Bold)); noUseShipHelmText.Text = "Acercate a la proa"; noUseShipHelmText.Color = Color.Red; noUseShipHelmText.Align = TgcText2D.TextAlign.RIGHT; noUseShipHelmText.Position = new Point((W / 2) - 180, (H / 2) - 5); noUseShipHelmText.Size = new Size(300, 100); noUseShipHelmText.changeFont(new Font("TimesNewRoman", 14)); gui.Create(MediaDir); gui.InitDialog(false, false); }
private void GenerarTexto() { string dialogo = "Posicion = ({0} | {1} | {2})"; dialogo = string.Format(dialogo, this.GetPosition().X, this.GetPosition().Y, this.GetPosition().Z); texto = Text.newText(dialogo, 120, 300); texto.Color = Color.Blue; }
public void InicializarTextos(TgcText2D instancia, Color color, TgcText2D.TextAlign Align, Point position, Size size, Font fuente) { instancia.Color = color; instancia.Align = Align; instancia.Position = position; instancia.Size = size; instancia.changeFont(fuente); }
public Informador(TgcText2D drawer, float ScreenRes_X, float ScreenRes_Y) { this.ScreenRes_X = ScreenRes_X; this.ScreenRes_Y = ScreenRes_Y; this.drawer = drawer; tiempoInforme = tiempoInformeMaximo; }
/// <summary> /// crea un texto con el valor indicado y la configuración por defecto /// </summary> /// <param name="value"></param> /// <returns></returns> public static TgcText2D createText(String value) { TgcText2D text = new TgcText2D(); text.changeFont(new Font(FontFamily.GenericMonospace, GUI.DefaultFontSize, FontStyle.Bold)); text.Color = Color.LimeGreen; text.Align = TgcText2D.TextAlign.LEFT; text.Text = value; return(text); }
public static TgcText2D newText(string formato, int x, int y) { TgcText2D texto = new TgcText2D(); texto.Text = formato; texto.Position = new Point(x, y); texto.Size = new Size(0, 0); texto.Color = Color.Gold; return(texto); }
public Escena(TgcCamera Camera, String MediaDir, String ShadersDir, TgcText2D DrawText, float TimeBetweenUpdates, TgcD3dInput Input) { this.Camera = Camera; this.MediaDir = MediaDir; this.ShadersDir = ShadersDir; this.DrawText = DrawText; this.TimeBetweenUpdates = TimeBetweenUpdates; this.Input = Input; drawer2D = new Drawer2D(); }
/// <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() { //Device de DirectX para crear primitivas. d3dDevice = D3DDevice.Instance.Device; //Instancio el loader del framework loader = new TgcSceneLoader(); //creo usuario Player1 = new Player(); Player1.gameModel = this; //inicializo mesh para hacha Axe = loader.loadSceneFromFile(MediaDir + "Meshes\\Hacha\\Hacha-TgcScene.xml").Meshes[0]; //Inicializo cámara MyCamera = new TgcFpsCamera(Player1, Axe, Input, (MapLength / 2), -(MapLength / 2), (MapLength / 2), -(MapLength / 2)); Camara = MyCamera; Frustum.updateVolume(D3DDevice.Instance.Device.Transform.View, D3DDevice.Instance.Device.Transform.Projection); //genero el mundo MyWorld = new World(MediaDir, d3dDevice, loader, Camara, Frustum, MapLength, true); MyWorld.RenderDistance = RenderDistance; //inicializo efectos effectsManager = new EffectsManager(ShadersDir, this, MyWorld, ElapsedTime); effectsManager.applyEffect(Axe); //emisor de partículas emitter = new ParticleEmitter(MediaDir + "Textures\\smokeParticle.png", 10); emitter.Position = new Vector3(0, 0, 0); emitter.MinSizeParticle = 2f; emitter.MaxSizeParticle = 5f; emitter.ParticleTimeToLive = 1f; emitter.CreationFrecuency = 1f; emitter.Dispersion = 25; emitter.Speed = new Vector3(5f, 5f, 5f); //colisiones pickingRay = new TgcPickingRay(Input); //sonidos soundPlayer = new SoundPlayer(DirectSound, MediaDir); soundPlayer.startAmbient(); //gui MenuInterface = new GUI(MediaDir, D3DDevice.Instance, Player1, this); TopRightText = GameUtils.createText("", 0, 0, 20, true); TopRightText.Color = Color.LightGray; TopRightText.Align = TgcText2D.TextAlign.RIGHT; CenterText = GameUtils.createText("", 0, (D3DDevice.Instance.Height * 0.85f), 25, true); CenterText.Color = Color.DodgerBlue; CenterText.Align = TgcText2D.TextAlign.CENTER; }
public TerrainBrush(TgcTerrainEditor editor) { SoundEnabled = true; text = new TgcText2D(); text.Align = TgcText2D.TextAlign.RIGHT; text.changeFont(new Font("Arial", 12, FontStyle.Bold)); bBrush = TGCBox.fromSize(new TGCVector3(10, 100, 10)); sound = new TgcStaticSound(); sound.loadSound(editor.MediaDir + "Sound\\tierra.wav", editor.DirectSound.DsDevice); }
public ConfiguracionPartido(string pathRecursos, int width, TgcThirdPersonCamera camara, EjemploAlumno main) { //Titulo this.titulo = new TgcText2D(); this.titulo.Text = "Configuración del partido"; this.titulo.Color = Color.White; this.titulo.Align = TgcText2D.TextAlign.CENTER; this.titulo.Size = new Size(400, 100); this.titulo.changeFont(new System.Drawing.Font("Arial", 24)); this.titulo.Position = new Point((width - this.titulo.Size.Width) / 2, 20); //Menu this.menus = new List <MenuItem>(); this.menus.Add(new MenuItem("listo", new Vector3(-7, 4, 0), new Vector3(14, 2, 0), pathRecursos + "Menu\\listo.png", pathRecursos + "Menu\\listo-seleccionado.png")); this.menus.Add(new MenuItem("uniformeLocal", new Vector3(-7, 1, 0), new Vector3(14, 4, 0), pathRecursos + "Menu\\local.png", pathRecursos + "Menu\\local-seleccionado.png")); this.menus.Add(new MenuItem("uniformeVisitante", new Vector3(-7, -3, 0), new Vector3(14, 4, 0), pathRecursos + "Menu\\visitante.png", pathRecursos + "Menu\\visitante-seleccionado.png")); this.menus.Add(new MenuItem("pelota", new Vector3(7, 3.2f, 0), new Vector3(14, 4, 0), pathRecursos + "Menu\\pelota.png", pathRecursos + "Menu\\pelota-seleccionado.png")); this.menus.Add(new MenuItem("camara", new Vector3(7, 0.2f, 0), new Vector3(14, 2, 0), pathRecursos + "Menu\\camara.png", pathRecursos + "Menu\\camara-seleccionado.png")); this.menus.Add(new MenuItem("volver", new Vector3(7, -2.2f, 0), new Vector3(14, 2, 0), pathRecursos + "Menu\\volver.png", pathRecursos + "Menu\\volver-seleccionado.png")); //Pelotas this.pelotas = new List <TgcSphere>(); //TODO cambiar por matrices this.pelotas.Add(this.CrearPelota(pathRecursos, new Vector3(10, 3.2f, 0), TgcTexture.createTexture(pathRecursos + Settings.Default.textureBall))); this.pelotas.Add(this.CrearPelota(pathRecursos, new Vector3(10, 3.2f, 0), TgcTexture.createTexture(pathRecursos + "Texturas\\pelota2.jpg"))); this.pelotas.Add(this.CrearPelota(pathRecursos, new Vector3(10, 3.2f, 0), TgcTexture.createTexture(pathRecursos + "Texturas\\pelota3.jpg"))); //Jugadores this.jugadores = new List <TgcSkeletalMesh>(); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + Settings.Default.textureTeam1))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + Settings.Default.textureTeam2))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvw.jpg"))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvwBlack.png"))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvwOrange.png"))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvwViolet.png"))); //Camaras this.camaras = new List <TgcText2D>(); this.camaras.Add(this.CrearCamara("Pelota", width)); //this.camaras.Add(this.CrearCamara("Jugador", screenSize)); this.camaras.Add(this.CrearCamara("Aérea", width)); this.menus[0].Select(); this.pelota = 0; this.jugadorLocal = 0; this.jugadorVisitante = 1; this.camaraSeleccionada = 0; this.positionJugadorLocal = new Vector3(-4, -0.1f, 0); this.positionJugadorVisitante = new Vector3(-4, -4, 0); this.camara = camara; this.main = main; }
public ConfiguracionPartido(string pathRecursos, int width, TgcThirdPersonCamera camara, EjemploAlumno main) { //Titulo this.titulo = new TgcText2D(); this.titulo.Text = "Configuración del partido"; this.titulo.Color = Color.White; this.titulo.Align = TgcText2D.TextAlign.CENTER; this.titulo.Size = new Size(400, 100); this.titulo.changeFont(new System.Drawing.Font("Arial", 24)); this.titulo.Position = new Point((width - this.titulo.Size.Width) / 2, 20); //Menu this.menus = new List<MenuItem>(); this.menus.Add(new MenuItem("listo", new Vector3(-7, 4, 0), new Vector3(14, 2, 0), pathRecursos + "Menu\\listo.png", pathRecursos + "Menu\\listo-seleccionado.png")); this.menus.Add(new MenuItem("uniformeLocal", new Vector3(-7, 1, 0), new Vector3(14, 4, 0), pathRecursos + "Menu\\local.png", pathRecursos + "Menu\\local-seleccionado.png")); this.menus.Add(new MenuItem("uniformeVisitante", new Vector3(-7, -3, 0), new Vector3(14, 4, 0), pathRecursos + "Menu\\visitante.png", pathRecursos + "Menu\\visitante-seleccionado.png")); this.menus.Add(new MenuItem("pelota", new Vector3(7, 3.2f, 0), new Vector3(14, 4, 0), pathRecursos + "Menu\\pelota.png", pathRecursos + "Menu\\pelota-seleccionado.png")); this.menus.Add(new MenuItem("camara", new Vector3(7, 0.2f, 0), new Vector3(14, 2, 0), pathRecursos + "Menu\\camara.png", pathRecursos + "Menu\\camara-seleccionado.png")); this.menus.Add(new MenuItem("volver", new Vector3(7, -2.2f, 0), new Vector3(14, 2, 0), pathRecursos + "Menu\\volver.png", pathRecursos + "Menu\\volver-seleccionado.png")); //Pelotas this.pelotas = new List<TgcSphere>(); //TODO cambiar por matrices this.pelotas.Add(this.CrearPelota(pathRecursos, new Vector3(10, 3.2f, 0), TgcTexture.createTexture(pathRecursos + Settings.Default.textureBall))); this.pelotas.Add(this.CrearPelota(pathRecursos, new Vector3(10, 3.2f, 0), TgcTexture.createTexture(pathRecursos + "Texturas\\pelota2.jpg"))); this.pelotas.Add(this.CrearPelota(pathRecursos, new Vector3(10, 3.2f, 0), TgcTexture.createTexture(pathRecursos + "Texturas\\pelota3.jpg"))); //Jugadores this.jugadores = new List<TgcSkeletalMesh>(); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + Settings.Default.textureTeam1))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + Settings.Default.textureTeam2))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvw.jpg"))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvwBlack.png"))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvwOrange.png"))); this.jugadores.Add(this.CrearJugador(pathRecursos, TgcTexture.createTexture(pathRecursos + Settings.Default.meshFolderPlayer + "Textures\\uvwViolet.png"))); //Camaras this.camaras = new List<TgcText2D>(); this.camaras.Add(this.CrearCamara("Pelota", width)); //this.camaras.Add(this.CrearCamara("Jugador", screenSize)); this.camaras.Add(this.CrearCamara("Aérea", width)); this.menus[0].Select(); this.pelota = 0; this.jugadorLocal = 0; this.jugadorVisitante = 1; this.camaraSeleccionada = 0; this.positionJugadorLocal = new Vector3(-4, -0.1f, 0); this.positionJugadorVisitante = new Vector3(-4, -4, 0); this.camara = camara; this.main = main; }
public EscenaGameOver(TgcCamera Camera, string MediaDir, string ShadersDir, TgcText2D DrawText, float TimeBetweenUpdates, TgcD3dInput Input) : base(Camera, MediaDir, ShadersDir, DrawText, TimeBetweenUpdates, Input) { gameOver = new CustomSprite(); gameOver.Bitmap = new CustomBitmap(MediaDir + "Textures\\GameOver.png", D3DDevice.Instance.Device); gameOver.Scaling = new TGCVector2((float)D3DDevice.Instance.Width / gameOver.Bitmap.Width, (float)D3DDevice.Instance.Height / gameOver.Bitmap.Height); gameOver.Position = new TGCVector2(0, 0); mp3Gameover = new TgcMp3Player(); mp3Gameover.FileName = MediaDir + "Music\\GameOver.mp3"; mp3Gameover.play(true); }
public void Render() { RuedaMeshDer.render(); RuedaMeshIzq.render(); if (SonDelanteras) { TgcText2D Drawtext = new TgcText2D(); Drawtext.drawText("I = " + TgcParserUtils.printVector3(RuedaMeshIzq.Position), 0, 100, Color.OrangeRed); Drawtext.drawText("D =" + TgcParserUtils.printVector3(RuedaMeshDer.Position), 0, 120, Color.OrangeRed); } }
public void Init() { var d3dDevice = D3DDevice.Instance.Device; drawer2D = new Drawer2D(); #region configurarSprites CustomSprite sprite = new CustomSprite(); sprite.Bitmap = new CustomBitmap(GameModel.mediaDir + "\\sprites\\emoji.png", D3DDevice.Instance.Device); var textureSize = sprite.Bitmap.Size; sprite.Position = new TGCVector2(FastMath.Max(D3DDevice.Instance.Width - textureSize.Width / 0.75f, 0), 0); sprites.Add(sprite); CustomSprite plantas = new CustomSprite(); plantas.Bitmap = new CustomBitmap(GameModel.mediaDir + "\\sprites\\PLANTAS.png", D3DDevice.Instance.Device); textureSize = plantas.Bitmap.Size; plantas.Position = new TGCVector2(0, FastMath.Max(D3DDevice.Instance.Height - textureSize.Height, 0)); sprites.Add(plantas); CustomSprite girasol = new CustomSprite(); girasol.Bitmap = new CustomBitmap(GameModel.mediaDir + "\\sprites\\girasol.png", D3DDevice.Instance.Device); girasol.Position = new TGCVector2(30, 30); sprites.Add(girasol); CustomSprite zombie = new CustomSprite(); zombie.Bitmap = new CustomBitmap(GameModel.mediaDir + "\\sprites\\zombie.png", D3DDevice.Instance.Device); zombie.Position = new TGCVector2(30, 100); sprites.Add(zombie); GOD.Bitmap = new CustomBitmap(GameModel.mediaDir + "\\sprites\\GOD.png", D3DDevice.Instance.Device); GOD.Position = new TGCVector2(FastMath.Max(D3DDevice.Instance.Width - 60, 0), 0); #endregion #region texto //Crear texto 2, especificando color, alineacion, posicion, tamano y fuente. soles = new TgcText2D(); soles.Text = "" + GameLogic.cantidadEnergia; soles.Color = Color.GreenYellow; soles.Align = TgcText2D.TextAlign.LEFT; soles.Position = new Point(100, 40); soles.Size = new Size(100, 10); soles.changeFont(new Font("Console", 25, FontStyle.Bold | FontStyle.Italic)); zombies = new TgcText2D(); zombies.Text = "" + GameLogic.cantidadZombiesMuertos; zombies.Color = Color.LawnGreen; zombies.Align = TgcText2D.TextAlign.LEFT; zombies.Position = new Point(100, 110); zombies.Size = new Size(100, 10); zombies.changeFont(new Font("Console", 25, FontStyle.Bold | FontStyle.Italic)); #endregion }
private void CrearTexto(string text) { var viewport = D3DDevice.Instance.Device.Viewport; texto = new TgcText2D(); texto.Position = new Point(viewport.Width / 2 - 100, viewport.Height / 2 - offsetTexto); texto.Size = new Size(200, 50); texto.changeFont(new Font("TimesNewRoman", 50, FontStyle.Regular)); texto.Color = Color.Yellow; texto.Align = TgcText2D.TextAlign.CENTER; texto.Text = text; }
private void SetearTextoGameOver() { textoGameOver = new TgcText2D { Text = "GAME\nOVER", Color = Color.Black, Align = TgcText2D.TextAlign.CENTER, Position = new Point(500, 300), Size = new Size(400, 200) }; textoGameOver.changeFont(new System.Drawing.Font("TimesNewRoman", 100, FontStyle.Bold | FontStyle.Italic)); }
public void render(float elapseElapsedTime) { text2d = new TgcText2D(); text2d.Text = this.GenerarMinutosYSegundos(elapseElapsedTime); text2d.Color = Color.WhiteSmoke; text2d.Align = TgcText2D.TextAlign.LEFT; text2d.Position = new Point(D3DDevice.Instance.Width - 150, 0); text2d.Size = new Size(300, 100); text2d.changeFont(new Font("TimesNewRoman", 25, FontStyle.Bold)); text2d.Color = Color.Yellow; text2d.render(); }
private TgcText2D CrearCamara(string texto, int width) { TgcText2D textoCamara = new TgcText2D(); textoCamara.Text = texto; textoCamara.Color = Color.White; textoCamara.Align = TgcText2D.TextAlign.CENTER; textoCamara.Size = new Size(400, 100); textoCamara.changeFont(new System.Drawing.Font("Arial", 14)); textoCamara.Position = new Point(width - textoCamara.Size.Width + 35, 242); return(textoCamara); }
public VegetationPicker(TgcTerrainEditor editor) { label = new TgcText2D(); label.Color = Color.Yellow; label.Align = TgcText2D.TextAlign.LEFT; font = new Font("Arial", 12, FontStyle.Bold); label.changeFont(font); Rotation = RotationAxis.Y; SoundEnabled = true; sound = new TgcStaticSound(); sound.loadSound(editor.MediaDir + "Sound\\pisada arena dcha.wav", -2000, editor.DirectSound.DsDevice); }
private void createText(int width, int height) { this.currentTechnique = new TgcText2D(); this.currentTechnique.Position = new Point(width - 200, height - 100); this.currentTechnique.Size = new Size(100, 1000); this.currentTechnique.Color = Color.DarkRed; this.keyMap = new TgcText2D(); this.keyMap.Position = new Point(20, height - 400); this.keyMap.Size = new Size(1000, 1000); this.keyMap.Color = Color.Black; this.keyMap.Text = "Teclas:\nQ para cambiar de tecnica.\nU para mostrar el wireframe.\nI para mostrar el vector.\nO para rotar el mesh.\nZ/X para mover el vector.\nC/V para rotar el vector.\nB/N para modificar su norma.\nArriba/Abajo para modificar el factor"; }
private void AddLine(string line, Color color, TgcText2D text) { Lines.Add(new Line(line, color, text)); float targetHeight = 0; foreach (Line lineElement in Lines) { targetHeight += lineElement.textDrawer == textSmall ? SmallLineHeight : BigLineHeight; } height = targetHeight; width = findMaxLineLength() * (text == textSmall ? SmallLetterWidth : BigLetterWidth); }
public MenuInicial(string pathRecursos, TgcThirdPersonCamera camara, EjemploAlumno main) { this.main = main; this.camara = camara; this.drawer2D = new Drawer2D(); //Titulo this.titulo = new TgcText2D(); this.titulo.Text = "Socketes"; this.titulo.Color = Color.White; this.titulo.Align = TgcText2D.TextAlign.CENTER; this.titulo.Position = new Point(280, 0); this.titulo.Size = new Size(400, 100); this.titulo.changeFont(new System.Drawing.Font("Arial", 35)); //Brazuca this.pelota = new TgcSphere(); //TODO cambiar por matrices this.pelota.AutoTransformEnable = true; this.pelota.setTexture(TgcTexture.createTexture(pathRecursos + Settings.Default.textureBall)); this.pelota.Radius = 2.5f; this.pelota.LevelOfDetail = 4; this.pelota.Position = new Vector3(3, 0, -4); this.pelota.updateValues(); //Cancha donde esta la pelota this.cancha = TgcBox.fromSize(new Vector3(20, 0, 20), TgcTexture.createTexture(pathRecursos + Settings.Default.textureMenuField)); //TODO cambiar por matrices this.cancha.AutoTransformEnable = true; this.cancha.Position = new Vector3(0, -2.5f, 0); //Menu this.menus = new List<MenuItem>(); this.menus.Add(new MenuItem("picadito", new Vector3(-5, 2, 0), new Vector3(8, 1, 0), pathRecursos + Settings.Default.texturePicadito1, pathRecursos + Settings.Default.texturePicadito2)); this.menus.Add(new MenuItem("configuracion", new Vector3(-5, 0.8f, 0), new Vector3(8, 1, 0), pathRecursos + Settings.Default.textureControles1, pathRecursos + Settings.Default.textureControles2)); this.menus.Add(new MenuItem("salir", new Vector3(-5, -0.4f, 0), new Vector3(8, 1, 0), pathRecursos + Settings.Default.textureSalir1, pathRecursos + Settings.Default.textureSalir2)); this.menus[0].Select(); //Menu de configuracion //Crear Sprite this.panelConfiguracion = new CustomSprite(); this.panelConfiguracion.Bitmap = new CustomBitmap(pathRecursos + Settings.Default.texturePanelcontroles, D3DDevice.Instance.Device); this.panelConfiguracion.Scaling = new Vector2(0.75f, 0.75f); Size textureSize = this.panelConfiguracion.Bitmap.Size; this.panelConfiguracion.Position = new Vector2(FastMath.Max(D3DDevice.Instance.Width / 2 - textureSize.Width / 2, 0), FastMath.Max(D3DDevice.Instance.Height / 2 - textureSize.Height / 2, 0)); }
public Marcador(TgcText2D marcador, TgcText2D tiempo, string nombreEquipo1, string nombreEquipo2) { this.nombreEquipo1 = nombreEquipo1; this.golesEquipo1 = 0; this.nombreEquipo2 = nombreEquipo2; this.golesEquipo2 = 0; this.marcador = marcador; this.tiempo = tiempo; //TODO sacar GUIController lo uso para Ubicarlo centrado en la pantalla, se cambio por el singleton de device sigue siendo malo //Size screenSize = GuiController.Instance.Panel3d.Size; Size textoSize = new Size(800, 100); this.mensajeGol = new TgcText2D(); this.mensajeGol.Text = ""; this.mensajeGol.Color = Color.White; this.mensajeGol.Align = TgcText2D.TextAlign.CENTER; this.mensajeGol.Position = new Point(FastMath.Max(D3DDevice.Instance.Width / 2 - textoSize.Width / 2, 0), FastMath.Max(D3DDevice.Instance.Height / 2 - textoSize.Height / 2, 0)); this.mensajeGol.Size = textoSize; this.mensajeGol.changeFont(new Font("Arial", 48, FontStyle.Bold)); this.tiempoMensajeGol = new Stopwatch(); }
/// <summary> /// Crea el marcador del partido que tiene los goles y el tiempo /// </summary> /// <returns> Un Marcador con resultado y tiempo</returns> private Marcador CrearMarcador(string nombreEquipoLocal, string nombreEquipoVisitante) { //Marcador TgcText2D marcador = new TgcText2D(); marcador.Color = Color.White; marcador.Align = TgcText2D.TextAlign.CENTER; marcador.Position = new Point(0, 20); marcador.Size = new Size(200, 100); marcador.changeFont(new System.Drawing.Font("Arial", 14, FontStyle.Bold)); //Contador de Tiempo TgcText2D tiempo = new TgcText2D(); tiempo.Color = Color.White; tiempo.Align = TgcText2D.TextAlign.CENTER; tiempo.Position = new Point(0, 40); tiempo.Size = new Size(200, 100); tiempo.changeFont(new System.Drawing.Font("Arial", 14)); return new Marcador(marcador, tiempo, nombreEquipoLocal, nombreEquipoVisitante); }
private TgcText2D CrearCamara(string texto, int width) { TgcText2D textoCamara = new TgcText2D(); textoCamara.Text = texto; textoCamara.Color = Color.White; textoCamara.Align = TgcText2D.TextAlign.CENTER; textoCamara.Size = new Size(400, 100); textoCamara.changeFont(new System.Drawing.Font("Arial", 14)); textoCamara.Position = new Point(width - textoCamara.Size.Width + 35, 242); return textoCamara; }