public override void Draw() { Render.Draw(tex, this.Pos, Color.White, new Vector2f(10, 31), 1, 0f); Render.Draw(col, this.Pos, Color.White, new Vector2f(10, 31), 1, 0f); Render.Draw(shield, this.Pos, new Color(0, 240, 0), new Vector2f(400, 400), 1, 0, size); base.Draw(); }
public override void Draw() { if ((lifeRemaining > 120) || MainGame.rand.Next(0, 2) == 1) { Render.Draw(Texture, Pos - new Vector2f(0, 3), c, new Vector2f(Texture.Size.X / 2, Texture.Size.Y / 2), 1, Rot, 1); } base.Draw(); }
public override void Draw() { if (inactiveTimer < 120 && inactiveTimer % 2 == 0) { return; } Render.Draw(this.Texture, this.Pos + new Vector2f(0, 1), new Color(255, 255, 255, (byte)Alpha), origin, 1, 0f); base.Draw(); }
public override void Draw() { Render.Draw(tex, this.Pos, Color.White, new Vector2f(9, 6), 1, 0f); if (timer > 60) { Render.Draw(shield, this.Pos, Color.Red, new Vector2f(400, 400), 1, 0, size); } //Render.DrawString(Content.GetFont("PixelSix.ttf"), ID + "", this.Pos - new Vector2f(0, 10), Color.White, .3f, true); base.Draw(); }
public override void Draw() { Render.Draw(tex, this.Pos, Color.White, new Vector2f(10, 31), 1, 0f); Render.Draw(col, this.Pos, Color.White, new Vector2f(10, 31), 1, 0f); Render.renderStates = shader; Vector2i center = MainGame.window.MapCoordsToPixel(Pos); Vector2f centerf = new Vector2f(center.X, MainGame.WindowSize.Y - center.Y); float seconds = (float)(DateTime.Now - MainGame.startTime).TotalMilliseconds / 1000f; shader.Shader.SetParameter("center", centerf); shader.Shader.SetParameter("seconds", seconds); Render.DrawCircle(Pos, Radius); Render.renderStates = null; base.Draw(); }
public override void Draw() { if (!Alive) { return; } Core = Pos - new Vector2f(-1, 35); this.Texture = animation.Texture; Render.renderStates = Actor.shader; Texture pistolHand = Content.GetTexture(model.pistolHand); Texture weaponTexture = weapon.texture; if (ouchTimer > 0) { shader.Shader.SetParameter("ouch", 1f); } else { shader.Shader.SetParameter("ouch", 0f); } shader.Shader.SetParameter("sampler", pistolHand); Render.Draw(pistolHand, Core, Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1); shader.Shader.SetParameter("sampler", weaponTexture); Render.Draw(weaponTexture, Core, Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1); shader.Shader.SetParameter("sampler", Texture); Render.DrawAnimation(Texture, this.Pos, Color.White, new Vector2f(Texture.Size.X / (animation.Count * 4), Texture.Size.Y - animation.YOffset), Facing, animation.Count, animation.Frame, 1); Render.renderStates = null; //Render.DrawString(Content.GetFont("Font1.ttf"), Name, Core - new Vector2f(0, 40), Color.White, .3f, true, 1); if (!Name.Equals(null)) { Render.DrawString(Content.GetFont("PixelSix.ttf"), Name, this.Core - new Vector2f(0, 40), Color.White, .3f, true, 1); } base.Draw(); }
public static void Draw() { MainGame.window.SetView(MainGame.GuiCamera); if (!shopping && !emoteMenuOpen) { if (MainGame.dm.roundStarted) { float fakeTime = MainGame.dm.roundTimeLeft - 10; if (fakeTime > 10) { if (fakeTime < 2500) //The timer will start at an { Color c = Color.White; if (MainGame.dm.firstPlacePlayer.UID == MainGame.dm.player.UID) { c = Color.Yellow; //Changing this makes your name a different color if you're winning } Render.DrawString(Content.GetFont("PixelSix.ttf"), "Highest Bounty: " + MainGame.dm.firstPlacePlayer.Name, new Vector2f(200, 25), c, .4f, true, 1); Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), +(int)(fakeTime - 10) / 60 + ":" + String.Format("{0:D2}", (int)(fakeTime - 10) % 60) + " sec", new Vector2f(200, 3), fakeTime < 30 ? Color.Yellow : Color.White, fakeTime < 30 ? .7f : .6f, true, 1); } } else { Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), +MainGame.dm.roundTimeLeft - 10 + " sec", new Vector2f(200, 3), Color.Green, .6f, true, 1); string t = MainGame.dm.firstPlacePlayer.Name + " wins the round!"; Color c = Color.White; if (MainGame.dm.firstPlacePlayer.UID == MainGame.dm.player.UID) { c = Color.Yellow; } Render.DrawString(Content.GetFont("PixelSix.ttf"), t, new Vector2f(200, 25), c, .4f, true, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "Starting New Round", new Vector2f(200, 35), Color.White, .4f, true, 1); } } } if (emoteMenuOpen) { RectangleShape rectBG = new RectangleShape(new Vector2f(200, 60)); rectBG.Position = new Vector2f(100, 10); rectBG.FillColor = new Color(10, 10, 10, 150); rectBG.Draw(MainGame.window, RenderStates.Default); Render.Draw(Content.GetTexture("emote_cool.png"), new Vector2f(105, 35), Color.White, new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[1]", new Vector2f(120, 13), new Color(255, 255, 255), .5f, true, 1); Render.Draw(Content.GetTexture("emote_laugh.png"), new Vector2f(155, 35), Color.White, new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[2]", new Vector2f(170, 13), new Color(255, 255, 255), .5f, true, 1); Render.Draw(Content.GetTexture("emote_silly.png"), new Vector2f(205, 35), Color.White, new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[3]", new Vector2f(220, 13), new Color(255, 255, 255), .5f, true, 1); Render.Draw(Content.GetTexture("emote_shocked.png"), new Vector2f(255, 35), Color.White, new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[4]", new Vector2f(270, 13), new Color(255, 255, 255), .5f, true, 1); if (MainGame.dm.player.Alive) { if (Input.isKeyTap(Keyboard.Key.Num1)) { string s = "cool"; MainGame.dm.GameObjects.Add(new EmoteBubble(s, MainGame.dm.player)); MainGame.dm.Mailman.SendEmote(s); emoteMenuOpen = false; } if (Input.isKeyTap(Keyboard.Key.Num2)) { string s = "laugh"; MainGame.dm.GameObjects.Add(new EmoteBubble(s, MainGame.dm.player)); MainGame.dm.Mailman.SendEmote(s); emoteMenuOpen = false; } if (Input.isKeyTap(Keyboard.Key.Num3)) { string s = "silly"; MainGame.dm.GameObjects.Add(new EmoteBubble(s, MainGame.dm.player)); MainGame.dm.Mailman.SendEmote(s); emoteMenuOpen = false; } if (Input.isKeyTap(Keyboard.Key.Num4)) { string s = "shocked"; MainGame.dm.GameObjects.Add(new EmoteBubble(s, MainGame.dm.player)); MainGame.dm.Mailman.SendEmote(s); emoteMenuOpen = false; } } } if (shopping) { RectangleShape rectBG = new RectangleShape(new Vector2f(200, 80)); rectBG.Position = new Vector2f(100, 10); rectBG.FillColor = new Color(10, 10, 10, 150); rectBG.Draw(MainGame.window, RenderStates.Default); int shotgunCost = 200; int machinegunCost = 275; int bombCost = 325; Render.Draw(Content.GetTexture("revolver.png"), new Vector2f(100, 40), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold > 0 ? 255 : 55)), new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), "Free", new Vector2f(120, 60), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold > 0 ? 255 : 55)), .5f, true, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[1]", new Vector2f(120, 13), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold > 0 ? 255 : 55)), .5f, true, 1); Render.Draw(Content.GetTexture("shotgun.png"), new Vector2f(140, 40), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= shotgunCost ? 255 : 55)), new Vector2f(0, 0), 1, 0f); if (MainGame.dm.player.weapons[1] == null) { Render.DrawString(Content.GetFont("PixelSix.ttf"), "" + shotgunCost + "c", new Vector2f(165, 60), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= shotgunCost ? 255 : 55)), .5f, true, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[2]", new Vector2f(165, 13), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= shotgunCost ? 255 : 55)), .5f, true, 1); } Render.Draw(Content.GetTexture("machinegun.png"), new Vector2f(200, 40), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= machinegunCost ? 255 : 55)), new Vector2f(0, 0), 1, 0f); if (MainGame.dm.player.weapons[2] == null) { Render.DrawString(Content.GetFont("PixelSix.ttf"), "" + machinegunCost + "c", new Vector2f(225, 60), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= machinegunCost ? 255 : 55)), .5f, true, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[3]", new Vector2f(225, 13), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= machinegunCost ? 255 : 55)), .5f, true, 1); } Render.Draw(Content.GetTexture("bomb.png"), new Vector2f(260, 40), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= bombCost ? 255 : 55)), new Vector2f(0, 0), 1, 0f); if (MainGame.dm.player.weapons[3] == null) { Render.DrawString(Content.GetFont("PixelSix.ttf"), "" + bombCost + "c", new Vector2f(275, 60), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= bombCost ? 255 : 55)), .5f, true, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[4]", new Vector2f(275, 13), new Color(255, 255, 255, (byte)(MainGame.dm.player.gold >= bombCost ? 255 : 55)), .5f, true, 1); } if (Input.isKeyTap(Keyboard.Key.Num2)) { if (MainGame.dm.player.weapons[1] == null) { if (MainGame.dm.player.gold >= shotgunCost) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("cashReg.wav"), 1, 0, 5)); MainGame.dm.player.gold -= shotgunCost; MainGame.dm.player.weapons[1] = (new Shotgun(MainGame.dm.player)); MainGame.dm.Mailman.sendWeaponSwitch(1); MainGame.dm.player.weapon = MainGame.dm.player.weapons[1]; shopping = false; } } } if (Input.isKeyTap(Keyboard.Key.Num3)) { if (MainGame.dm.player.weapons[2] == null) { if (MainGame.dm.player.gold >= machinegunCost) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("cashReg.wav"), 1, 0, 5)); MainGame.dm.player.gold -= machinegunCost; MainGame.dm.player.weapons[2] = (new MachineGun(MainGame.dm.player)); MainGame.dm.Mailman.sendWeaponSwitch(2); MainGame.dm.player.weapon = MainGame.dm.player.weapons[2]; shopping = false; } } } if (Input.isKeyTap(Keyboard.Key.Num4)) { if (MainGame.dm.player.weapons[3] == null) { if (MainGame.dm.player.gold >= bombCost) { MainGame.soundInstances.Add(new SoundInstance(Content.GetSound("cashReg.wav"), 1, 0, 5)); MainGame.dm.player.gold -= bombCost; MainGame.dm.player.weapons[3] = (new BombWeapon(MainGame.dm.player)); MainGame.dm.Mailman.sendWeaponSwitch(3); MainGame.dm.player.weapon = MainGame.dm.player.weapons[3]; shopping = false; } } } } Vector2f mouse = MainGame.window.MapPixelToCoords(Input.screenMousePos); Vector2u crosshairOriginU = Content.GetTexture("crosshair.png").Size / 2; Vector2f crosshairOrigin = new Vector2f(crosshairOriginU.X, crosshairOriginU.Y); Sprite healthBar = new Sprite(Content.GetTexture("healthBarVert.png")); healthBar.Position = mouse; healthBar.Origin = crosshairOrigin - new Vector2f(0, 10); healthBar.TextureRect = new IntRect(0, 10, (int)healthBar.Texture.Size.X, (int)(24 * ((float)MainGame.dm.player.Health / 100f))); healthBar.Scale = new Vector2f(1, -1f); healthBar.Draw(MainGame.window, RenderStates.Default); Sprite ammoBar = new Sprite(Content.GetTexture("ammoBarVert.png")); ammoBar.Position = mouse; ammoBar.Origin = crosshairOrigin - new Vector2f(0, 10); ammoBar.Scale = new Vector2f(1, -1f); if (MainGame.dm.player.weapon.Ammo > 0) { ammoBar.TextureRect = new IntRect(0, 10, (int)healthBar.Texture.Size.X, (int)(24 * ((float)(MainGame.dm.player.weapon.Ammo / (float)MainGame.dm.player.weapon.MaxAmmo)))); } else { ammoBar.TextureRect = new IntRect(0, 10, (int)healthBar.Texture.Size.X, (int)(24 * ((float)(70 - (MainGame.dm.player.weapon.ReloadTimer / MainGame.dm.player.weapon.ReloadSpeed))))); ammoBar.Color = Color.Red;//new Color(0, 0, 0, 170); } ammoBar.Draw(MainGame.window, RenderStates.Default); //Render.Draw(Content.GetTexture("healthBarVert.png"), mouse, Color.White, crosshairOrigin, 1, 0, 1 + CrosshairFireExpand); //Render.Draw(Content.GetTexture("ammoBarVert.png"), mouse, Color.White, crosshairOrigin, 1, 0, 1 + CrosshairFireExpand); Sprite healthBar2 = new Sprite(Content.GetTexture("healthBar.png")); healthBar2.Position = new Vector2f(25, 3); healthBar2.TextureRect = new IntRect(0, 0, (int)(healthBar2.Texture.Size.X * ((float)MainGame.dm.player.Health / 100f)), (int)healthBar2.Texture.Size.Y); //healthBar2.Scale = new Vector2f(1, -1f); healthBar2.Draw(MainGame.window, RenderStates.Default); //shader.Shader.SetParameter("sampler", pistolHand); //Render.Draw(pistolHand, Core + Helper.PolarToVector2(holdDistance, AimAngle, 1, 1), Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1); Render.Draw(Content.GetTexture("characterUI.png"), new Vector2f(0, 0), Color.White, new Vector2f(0, 0), 1, 0f); Render.Draw(Content.GetTexture(MainGame.dm.player.model.gibHeadFile), new Vector2f(0, 3), Color.White, new Vector2f(0, 0), 1, 0f, 1.5f); Render.DrawString(Content.GetFont("PixelSix.ttf"), MainGame.dm.player.gold + "", new Vector2f(35, 30), Color.White, .5f, true, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), MainGame.dm.player.Name, new Vector2f(2, 55), Color.White, .3f, false, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[C] Shop", new Vector2f(2, 65), Color.White, .25f, false, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[V] Emotes", new Vector2f(2, 75), Color.White, .25f, false, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[E] Use Item" + (MainGame.dm.player.ItemTimer <= 0? "" : ": " + MainGame.dm.player.ItemTimer / 60), new Vector2f(2, 85), Color.White, .25f, false, 1); if (!MainGame.dm.player.Alive) { if (MainGame.dm.player.respawnTimer > 0) { Render.DrawString(Content.GetFont("PixelSix.ttf"), (MainGame.dm.player.respawnTimer / 60) + 1 + "", new Vector2f(200, 45), Color.White, .9f, true, 1); } else { Render.DrawString(Content.GetFont("PixelSix.ttf"), "Respawn!", new Vector2f(200, 45), Color.White, .9f, true, 1); Render.DrawString(Content.GetFont("PixelSix.ttf"), "[Left Shift]", new Vector2f(200, 75), Color.White, .4f, true, 1); } } if (ChatOpen) { RectangleShape rectBG = new RectangleShape(new Vector2f(350, 85)); rectBG.Position = new Vector2f(1, 198); rectBG.FillColor = new Color(10, 10, 10, 150); rectBG.Draw(MainGame.window, RenderStates.Default); RectangleShape rectBG2 = new RectangleShape(new Vector2f(350, 12)); rectBG2.Position = new Vector2f(1, 285); rectBG2.FillColor = new Color(10, 10, 10, 200); rectBG2.Draw(MainGame.window, RenderStates.Default); Font font = Content.GetFont("OldNewspaperTypes.ttf"); for (int i = 0; i < Chats.Count; i++) { Render.DrawString(font, Chats[i], new Vector2f(10, 265 - (i * 15)), Color.White, .35f, false, 1); } //int subStringStart = Draft.Length > 50 ? Draft.Length - 50 : 0; Render.DrawString(font, Draft.ToString(), new Vector2f(10, 283), Color.White, .35f, false, 1); if (Composing) { Text textBar = new Text(Draft.ToString(), font); Render.DrawString(font, "|", new Vector2f(10 + textBar.GetLocalBounds().Width * .35f, 283), Color.White, .35f, false, 1); } } for (int i = 0; i < FragTexts.Count; i++) { int spacing = 4; int rightX = 390; Font font = Content.GetFont("OldNewspaperTypes.ttf"); Text textKiller = new Text(FragTexts[i].killer.ToString(), font); Text textVictim = new Text(FragTexts[i].victim.ToString(), font); float scale = .25f; int topY = 20; Render.DrawString(font, FragTexts[i].killer, new Vector2f(rightX - (textVictim.GetLocalBounds().Width *scale) - (textKiller.GetLocalBounds().Width *scale) - (FragTexts[i].icon.Size.X + (spacing * 2)), topY + i * 15), Color.White, scale, false, 0); Render.Draw(FragTexts[i].icon, new Vector2f(rightX - (textVictim.GetLocalBounds().Width *scale) - (FragTexts[i].icon.Size.X + spacing), topY + 2 + i * 15), Color.White, new Vector2f(0, 0), 1, 0); Render.DrawString(font, FragTexts[i].victim, new Vector2f(rightX - (textVictim.GetLocalBounds().Width *scale), topY + i * 15), Color.White, scale, false, 0); //Font font = Content.GetFont("OldNewspaperTypes.ttf"); //Text textKiller = new Text(FragTexts[i].killer.ToString(), font); //Text textVictim = new Text(FragTexts[i].victim.ToString(), font); //float scale = .3f; //Render.DrawString(font, FragTexts[i].victim, new Vector2f(rightX, 20), Color.White, scale, false, 0, true); //Render.Draw(FragTexts[i].icon, new Vector2f(rightX - (textVictim.GetLocalBounds().Width * scale) - spacing, 27), Color.White, (Vector2f)FragTexts[i].icon.Size / 2, 1, 0f); //Render.DrawString(font, FragTexts[i].killer, new Vector2f(rightX - (textKiller.GetLocalBounds().Width * scale) - (spacing * 2), 20), Color.White, scale, false, 0, true); } if (MainGame.dm.tunnel) { Render.Draw(Content.GetTexture("caution.png"), new Vector2f(350, 110), Color.White, new Vector2f(0, 0), 1, 0f); } for (int i = 0; i < MainGame.dm.GameObjects.Count; i++) { if (MainGame.dm.GameObjects[i] is TreasureBox) { TreasureBox box = MainGame.dm.GameObjects[i] as TreasureBox; Vector2f drawPos = box.Pos; if (Helper.Distance(box.Pos, MainGame.dm.player.Pos) > 320) { int flip = -1; if (box.Pos.X < MainGame.dm.player.Pos.X) { drawPos.X = 40; } else { drawPos.X = 350; flip = 1; } drawPos.Y = box.Pos.Y; if (!box.goldDropped) { Render.Draw(Content.GetTexture("treasureBubble.png"), drawPos, Color.White, new Vector2f(0, 0), flip, 0f); } } } } if (Input.isKeyDownOverride(Keyboard.Key.Tab)) { RectangleShape rectBG = new RectangleShape(new Vector2f(190, MainGame.dm.Players.Count * 20)); rectBG.Position = new Vector2f(100, 70); rectBG.FillColor = new Color(10, 10, 10, 150); rectBG.Draw(MainGame.window, RenderStates.Default); Font font = Content.GetFont("PixelSix.ttf"); for (int i = 0; i < MainGame.dm.Players.Count; i++) { Render.DrawString(font, MainGame.dm.Players[i].Name, new Vector2f(200, 70 + (i * 20)), Color.White, .45f, true, 1); } } if (Input.isKeyOverride(Keyboard.Key.Return)) { if (!ChatOpen || !Composing) { Input.isActive = false; ChatOpen = true; Composing = true; } else if (Draft.Length == 0) { Input.isActive = true; ChatOpen = false; Composing = false; } else { //if (Draft.ToString().IndexOf("/setname") == 0) //{ // string newName = ""; // try // { // newName = Draft.ToString().Substring(9).Trim(); // } // catch (Exception) // { // Chats.Insert(0, "Oops!"); // return; // } // if (newName.Length > maxNameCharacters) // newName = newName.Substring(0, maxNameCharacters); // if (MainGame.containsProfanity(newName)) // { // Chats.Insert(0, "Nope."); // } // else // { // Chats.Insert(0, "You have changed your name to " + newName); // MainGame.dm.player.Name = newName; // MainGame.dm.Mailman.SendName(newName); // } //} //else { string completeMessage = Draft.ToString(); MainGame.dm.Mailman.SendChat(completeMessage); Chats.Insert(0, MainGame.dm.player.Name + ": " + completeMessage); } Draft.Clear(); Input.isActive = true; ChatOpen = false; ChatCloseDelay = 60 * 4; Composing = false; } } Render.Draw(Content.GetTexture("crosshair.png"), mouse, Color.White, crosshairOrigin, 1, 0, 1 + CrosshairFireExpand); Render.Draw(Content.GetTexture("crosshairBars.png"), mouse, Color.White, crosshairOrigin, 1, 0, 1); }
public override void Draw() { //blue sky MainGame.window.SetView(MainGame.window.DefaultView); shader.Shader.SetParameter("offsetY", MainGame.Camera.Center.Y); RectangleShape rs = new RectangleShape { Size = new Vector2f(800, 600) }; MainGame.window.Draw(rs, shader); MainGame.window.SetView(MainGame.Camera); //background Render.Draw(Content.GetTexture("background1Far.png"), new Vector2f(-200, -100), Color.White, new Vector2f(0, 0), 1, 0f); Render.Draw(Content.GetTexture("background1Far.png"), new Vector2f(145, -100), Color.White, new Vector2f(0, 0), 1, 0f); Render.Draw(Content.GetTexture("background1.png"), new Vector2f(-200, -150), Color.White, new Vector2f(0, 0), 1, 0f); //tracks RectangleShape tracks = new RectangleShape(new Vector2f(800, .5f)); tracks.Position = new Vector2f(-400, -49); tracks.FillColor = new Color(10, 10, 10, 50); tracks.Draw(MainGame.window, RenderStates.Default); //train Render.Draw(Content.GetTexture("mapDecor.png"), new Vector2f(trainPosX, -55), new Color(255, 255, 255, 200), new Vector2f(0, 0), 1, 0f, .03f); //title Render.Draw(Content.GetTexture("title.png"), new Vector2f(-50, -190), new Color(255, 255, 255, 240), new Vector2f(0, 0), 1, 0f, .4f); if (stage == 0) { //menubox RectangleShape rectBG = new RectangleShape(new Vector2f(200, 110)); rectBG.Position = new Vector2f(-50, 0); rectBG.FillColor = new Color(10, 10, 10, 100); rectBG.Draw(MainGame.window, RenderStates.Default); if (!submitted) { //menu username rectUsername.FillColor = new Color(10, 10, 10, (byte)(composingUsername ? 150 : 50)); rectUsername.Draw(MainGame.window, RenderStates.Default); //menu ip rectIP.FillColor = new Color(10, 10, 10, (byte)(composingIP ? 150 : 50)); rectIP.Draw(MainGame.window, RenderStates.Default); //menu connect button rectConnect.FillColor = new Color(10, 255, 10, (byte)(rectConnect.GetGlobalBounds().Contains( (int)MainGame.worldMousePos.X, (int)MainGame.worldMousePos.Y) ? 150 : 70)); rectConnect.Draw(MainGame.window, RenderStates.Default); //text: username, ip, connect button Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), usernameField, new Vector2f(50, 15), Color.White, .3f, true, 1); Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), ipField, new Vector2f(50, 45), Color.White, .3f, true, 1); Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Connect", new Vector2f(50, 77), Color.White, .4f, true, 1); } else { Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Connecting...", new Vector2f(50, 15), Color.White, .3f, true, 1); submitTimer++; if (submitTimer > 300) { submitted = false; submitTimer = 0; ipField = "Failed to Connect"; } } } if (stage == 1) { RectangleShape rectBG = new RectangleShape(new Vector2f(200, 110)); rectBG.Position = new Vector2f(-50, 0); rectBG.FillColor = new Color(10, 10, 10, 100); rectBG.Draw(MainGame.window, RenderStates.Default); //char1.Update(); //char2.Update(); Render.DrawAnimation(char1.Texture, new Vector2f(-0, 5), Color.White, new Vector2f(0, 0), 1, char1.Count, char1.Frame); Render.DrawAnimation(char2.Texture, new Vector2f(100, 5), Color.White, new Vector2f(0, 0), -1, char2.Count, char2.Frame); //Render.Draw(Content.GetTexture("gibHead.png"), new Vector2f(40, 10), Color.White, new Vector2f(0, 0), 1, 0, 2); //Render.Draw(Content.GetTexture("char2_gibHead.png"), new Vector2f(0, 10), Color.White, new Vector2f(0, 0), 1, 0, 2); FloatRect leftRect = new FloatRect(new Vector2f(0, 5), new Vector2f(20, 55)); FloatRect rightRect = new FloatRect(new Vector2f(75, 5), new Vector2f(20, 55)); if (leftRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y)) { currentCursor = hoverCursor; if (Input.isMouseButtonTap(Mouse.Button.Left)) { stage = 2; MainGame.dm.player.model = MainGame.Char1Model; MainGame.dm.player.UpdateToCurrentModel(); return; } } if (rightRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y)) { currentCursor = hoverCursor; if (Input.isMouseButtonTap(Mouse.Button.Left)) { stage = 2; MainGame.dm.player.model = MainGame.Char2Model; MainGame.dm.player.UpdateToCurrentModel(); return; } } rectConnect.Draw(MainGame.window, RenderStates.Default); Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Select Character", new Vector2f(50, 77), Color.White, .4f, true, 1); } if (stage == 2) { RectangleShape rectBG = new RectangleShape(new Vector2f(200, 110)); rectBG.Position = new Vector2f(-50, 0); rectBG.FillColor = new Color(10, 10, 10, 100); rectBG.Draw(MainGame.window, RenderStates.Default); Render.Draw(Content.GetTexture("generatorStand.png"), new Vector2f(-10, 5), Color.White, new Vector2f(0, 0), 1, 0f); Render.Draw(Content.GetTexture("genBlue.png"), new Vector2f(-10, 5), Color.White, new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), " Shield\nGenerator", new Vector2f(0, 45), Color.White, .3f, true, 1); Render.Draw(Content.GetTexture("mine.png"), new Vector2f(40, 30), Color.White, new Vector2f(0, 0), 1, 0f); Render.Draw(Content.GetTexture("mine.png"), new Vector2f(40, 30), Color.White, new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), "Land\nMine", new Vector2f(50, 45), Color.White, .3f, true, 1); Render.Draw(Content.GetTexture("generatorStand.png"), new Vector2f(90, 5), Color.White, new Vector2f(0, 0), 1, 0f); Render.Draw(Content.GetTexture("genGreen.png"), new Vector2f(90, 5), Color.White, new Vector2f(0, 0), 1, 0f); Render.DrawString(Content.GetFont("PixelSix.ttf"), " Health\nGenerator", new Vector2f(100, 45), Color.White, .3f, true, 1); FloatRect genShieldRect = new FloatRect(new Vector2f(-10, 5), new Vector2f(20, 55)); FloatRect genHealthRect = new FloatRect(new Vector2f(90, 5), new Vector2f(20, 55)); FloatRect MineRect = new FloatRect(new Vector2f(40, 5), new Vector2f(20, 55)); if (genShieldRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y)) { currentCursor = hoverCursor; if (Input.isMouseButtonTap(Mouse.Button.Left)) { MainGame.dm.player.ItemType = 3; // Shield Generator Submit(); } } if (genHealthRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y)) { currentCursor = hoverCursor; if (Input.isMouseButtonTap(Mouse.Button.Left)) { MainGame.dm.player.ItemType = 2; // Health Generator Submit(); } } if (MineRect.Contains(MainGame.worldMousePos.X, MainGame.worldMousePos.Y)) { currentCursor = hoverCursor; if (Input.isMouseButtonTap(Mouse.Button.Left)) { MainGame.dm.player.ItemType = 1; // Land Mines Submit(); } } rectConnect.Draw(MainGame.window, RenderStates.Default); Render.DrawString(Content.GetFont("OldNewspaperTypes.ttf"), "Select Item", new Vector2f(50, 77), Color.White, .4f, true, 1); } //cursor Render.Draw(currentCursor, MainGame.worldMousePos, Color.White, new Vector2f(0, 0), 1, 0f); }
public override void Draw() { Render.Draw(this.Texture, this.Pos, Color.White, new Vector2f(0, 0), 1, 0f, 1); Render.Draw(this.Texture, this.Pos + new Vector2f(this.Texture.Size.X * 2, 0), Color.White, new Vector2f(0, 0), 1, 0f, 1, false, true); base.Draw(); }
public override void Draw() { Render.Draw(this.texture, this.Pos, Color.White, new Vector2f(0, 0), 1, 0f); base.Draw(); }
public override void Draw() { Render.Draw(Texture, this.Pos, Color.White, new Vector2f(Texture.Size.X / 2, Texture.Size.Y / 2), 1, Rot, 1); base.Draw(); }
public override void Draw() { base.Draw(); //MainGame.Camera.Center = player.Pos - new Vector2f(0,90); Vector2f focus = player.Core + new Vector2f(Input.screenMousePos.X - MainGame.WindowSize.X / 2, Input.screenMousePos.Y - MainGame.WindowSize.Y / 2) * player.CrosshairCameraRatio; if (Helper.Distance(player.Core, focus) > PlayerAimSphereRadius) { focus = player.Core + Helper.PolarToVector2(PlayerAimSphereRadius, player.AimAngle, 1, 1);//player.Core + Helper.normalize(focus) * 100; } Helper.MoveCameraTo(MainGame.Camera, focus, .04f); if (MainGame.Camera.Center.Y > 180 - 90) { focus.Y = player.Pos.Y - 90; MainGame.Camera.Center = new Vector2f(MainGame.Camera.Center.X, 180 - 90); } //Camera2D.returnCamera(player.ActorCenter + // new Vector2(Main.screenMousePos.X - Main.graphics.PreferredBackBufferWidth / 2, // Main.screenMousePos.Y - Main.graphics.PreferredBackBufferHeight / 2) * // Main.graphics.GraphicsDevice.Viewport.AspectRatio / player.currentWeapon.viewDistance); MainGame.window.SetView(MainGame.window.DefaultView); shader.Shader.SetParameter("offsetY", MainGame.Camera.Center.Y); RectangleShape rs = new RectangleShape { Size = new Vector2f(800, 600) }; MainGame.window.Draw(rs, shader); MainGame.window.SetView(MainGame.Camera); //foreach (Sprite s in BackgroundImagesFar) //{ // s.Position = new Vector2f(s.Position.X, 280 - MAPYOFFSET + (player.Pos.Y / 15)); //} BackgroundImagesFar.ForEach(p => { p.Draw(MainGame.window, RenderStates.Default); }); BackgroundImages.ForEach(p => { p.Draw(MainGame.window, RenderStates.Default); }); BackgroundGameObjects.ForEach(p => { p.Draw(); }); BackgroundTracks.ForEach(p => { p.Draw(MainGame.window, RenderStates.Default); }); HandleBackground(); MainGame.window.Draw(new Sprite(Content.GetTexture("mapDecor.png"))); int insideY = 65; if (player.Pos.Y > insideY) { //trainSoundExterior.volume = 1; trainSound = trainSoundExterior; // trainSoundInterior.volume = 0; interiorAlpha += (255f - interiorAlpha) * .1f; } else { //trainSoundInterior.volume = 0; interiorAlpha *= .95f; //trainSound = trainSoundInterior; //trainSoundExterior.volume = 0; } Render.Draw(Content.GetTexture("mapInterior.png"), new Vector2f(0, 0), new Color(255, 255, 255, (byte)interiorAlpha), new Vector2f(0, 0), 1, 0f); // MainGame.window.Draw(new Sprite(Content.GetTexture("mapInterior.png"))); Players.ForEach(p => { p.Draw(); }); Projectiles.ForEach(p => { p.Draw(); }); GameObjects.ForEach(p => { p.Draw(); }); if (player.Pos.Y < insideY) { Render.Draw(Content.GetTexture("mapDecor.png"), new Vector2f(0, 0), new Color(255, 255, 255, (byte)(255 - interiorAlpha)), new Vector2f(0, 0), 1, 0f); } //MainGame.window.Draw(mapSprite); Gui.Draw(); }
public override void Draw() { base.Draw(); if (!Alive) { return; } //if (frame == 1) //Console.Write(frame); //Render.Draw(animation.Texture, this.Pos, Color.White, new Vector2f(0,0), 1, 0,1); if (holdDistance < 0) { holdDistance += -holdDistance * .05f; } Core = Pos - new Vector2f(-1, 35); this.Texture = animation.Texture; Render.renderStates = Actor.shader; Texture pistolHand = Content.GetTexture(model.pistolHand); Texture weaponTexture = weapon.texture; if (ouchTimer > 0) { shader.Shader.SetParameter("ouch", 1f); } else { shader.Shader.SetParameter("ouch", 0f); } shader.Shader.SetParameter("sampler", pistolHand); Render.Draw(pistolHand, Core + Helper.PolarToVector2(holdDistance, AimAngle, 1, 1), Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1); if (weaponTexture != null) { shader.Shader.SetParameter("sampler", weaponTexture); Render.Draw(weaponTexture, Core + Helper.PolarToVector2(holdDistance, AimAngle, 1, 1), Color.White, new Vector2f(2, 4), 1, AimAngle, 1, Facing == -1); } shader.Shader.SetParameter("sampler", Texture); Render.DrawAnimation(Texture, this.Pos, Color.White, new Vector2f(Texture.Size.X / (animation.Count * 4), Texture.Size.Y - animation.YOffset), Facing, animation.Count, animation.Frame, 1); Render.renderStates = null; RectangleShape rect = new RectangleShape(); rect.Position = new Vector2f((int)Pos.X, (int)Pos.Y); rect.Size = new Vector2f(1, 1); rect.FillColor = Color.White; rect.OutlineColor = Color.White; //MainGame.window.Draw(rect); //Draw players collision point RectangleShape col = new RectangleShape(); col.Position = new Vector2f(collisionBox.Left, collisionBox.Top); col.Size = new Vector2f(collisionBox.Width, collisionBox.Height); col.FillColor = Color.White; col.OutlineColor = Color.Red; FloatRect bgRect = new FloatRect(new Vector2f(this.Core.X, this.Core.Y - 20), new Vector2f(100, 20)); //RectangleShape rectBG = new RectangleShape(); //rectBG.Position = new Vector2f(100, 10); //rectBG.FillColor = new Color(10, 10, 10, 150); //rectBG.Draw(MainGame.window, RenderStates.Default); Render.DrawString(Content.GetFont("PixelSix.ttf"), this.Name, this.Core - new Vector2f(0, 40), Color.White, .3f, true, 1); //MainGame.window.Draw(col); //Draw players collision box }
public override void Draw() { Render.Draw(Texture, Pos, new Color(255, 255, 255, (byte)(Alpha * 255)), new Vector2f(Texture.Size.X / 2, Texture.Size.Y / 2), 1, Rot, 1); base.Draw(); }