public DrawString ( |
||
spriteFont | A font. | |
text | StringBuilder | The text which will be drawn. |
position | System.Vector2 | The drawing location on screen. |
color | System.Color | A color mask. |
return | void |
public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { if (mask) { string maskVaue; if (value < 10) { maskVaue = "000" + value.ToString(); } else if (value < 100) { maskVaue = "00" + value.ToString(); } else if (value < 1000) { maskVaue = "0" + value.ToString(); } else { maskVaue = value.ToString(); } spriteBatch.DrawString(font, maskVaue, position, Color.White, 0, new Vector2(), fontSize, SpriteEffects.None, 0f); } else { spriteBatch.DrawString(font, value.ToString(), position, Color.White, 0, new Vector2(), fontSize, SpriteEffects.None, 0f); } }
public void Draw(SpriteBatch spriteBatch) { var player = ((SceneMap)SceneManager.Instance.GetCurrentScene()).Player; // Draw the hearts for (var i = 0; i < player.HP; i++) { spriteBatch.Draw(TextureRegion.Texture, _position + _hearthSpritePosition + (Vector2.UnitX * i * (_heartSprite.Width + 2)), _heartSprite, Color.White); } // Draw the lives for (var i = 0; i < player.Lives; i++) { spriteBatch.Draw(TextureRegion.Texture, _position + _lifeSpritePosition + (Vector2.UnitX * i * (_lifeSprite.Width + 2)), _lifeSprite, Color.White); } // Draw the ammo spriteBatch.Draw(TextureRegion.Texture, _position + _gunSpritePosition, _gunSprite, Color.White); spriteBatch.DrawString(SceneManager.Instance.GameFont, player.Ammo.ToString(), _position + _gunSpritePosition + (Vector2.UnitX * (_gunSprite.Width + 2)), _ammoTextColor); // Draw the coins spriteBatch.Draw(TextureRegion.Texture, _coinsPosition, _coinSprite, Color.White); spriteBatch.DrawString(SceneManager.Instance.GameFont, player.Coins.ToString(), _coinsPosition + new Vector2(_coinSprite.Width + 3, 1), _coinsTextColor); }
//<summary> //Draw the menu and buttons . Also sets the font color for drawing the current selection //</summary> //<param name="myBatch"> Represents the required sprite batch public void Draw(SpriteBatch myBatch) { colorExit = colorHelp = colorHisc = colorPlay = colorResume = Color.Green; if (downInc == -60) colorResume = Color.LawnGreen; else if (downInc == 0) colorPlay = Color.LawnGreen; else if (downInc == 60) colorHisc = Color.LawnGreen; else if (downInc == 120) colorHelp = Color.LawnGreen; else if (downInc == 180) colorExit = Color.LawnGreen; testBackground.Draw(myBatch); testButtonleft.SpritePosition = new Vector2(255 + leftInc + menuX, 255 + downInc + menuY); testButtonleft.Scale = (0.25f); testButtonleft.Draw(myBatch); testButtonright.SpritePosition = new Vector2(455 - leftInc + menuX, 255 + downInc + menuY); testButtonright.Scale = (0.25f); testButtonright.Draw(myBatch); if (mpauseStatus == true) { myBatch.DrawString(spriteFont, "RESUME", new Vector2(310 + menuX, 200 + menuY), colorResume, 0, new Vector2(0, 0), 2, 0, 1); } myBatch.DrawString(spriteFont, "NEW GAME", new Vector2(282 + menuX, 260 + menuY), colorPlay, 0, new Vector2(0, 0), 2, 0,1); myBatch.DrawString(spriteFont, "HIGH SCORES", new Vector2(253 + menuX, 320 + menuY), colorHisc, 0, new Vector2(0, 0), 2, 0, 1); myBatch.DrawString(spriteFont, "HELP", new Vector2(337 + menuX, 380 + menuY), colorHelp, 0, new Vector2(0, 0), 2, 0, 1); myBatch.DrawString(spriteFont, "EXIT", new Vector2(340 + menuX, 440 + menuY), colorExit, 0, new Vector2(0, 0), 2, 0, 1); }
public override void Draw(SpriteBatch sb) { if(wakeTime < wakeThresh) { float totDim = font.MeasureString(moneyTot).X; float diffDim = font.MeasureString(moneyDif).X; game.GraphicsDevice.BlendState = BlendState.AlphaBlend; sb.Draw(hudMonB, hud.scaledRect(monPos, 425, 151), Color.White); sb.Draw(hudMonF, hud.scaledRect(monPos, 425, 151), Color.White); sb.DrawString(font, moneyTot, hud.scaledCoords(monTotPos), Color.White, 0, new Vector2(font.MeasureString(moneyTot).X, font.MeasureString(moneyTot).Y / 2), hud.scale * (28.0f / 40), SpriteEffects.None, 0); if (game.ship.moneyManager.changing) { sb.DrawString(font, moneyDif, hud.scaledCoords(monDifPos.X + 3, monDifPos.Y + 3), hud.outline, 0, new Vector2(font.MeasureString(moneyDif).X, font.MeasureString(moneyDif).Y / 2), hud.scale * (28.0f / 40), SpriteEffects.None, 0); if (game.ship.moneyManager.difference < 0) sb.DrawString(font, moneyDif, hud.scaledCoords(monDifPos), hud.redBody, 0, new Vector2(font.MeasureString(moneyDif).X, font.MeasureString(moneyDif).Y / 2), hud.scale * (28.0f / 40), SpriteEffects.None, 0); else sb.DrawString(font, moneyDif, hud.scaledCoords(monDifPos.X, monDifPos.Y), hud.contSecondary, 0, new Vector2(font.MeasureString(moneyDif).X, font.MeasureString(moneyDif).Y / 2), hud.scale * (28.0f / 40), SpriteEffects.None, 0); } sb.Draw(TextureManager.icoMon, hud.scaledRect(monPos + new Vector2(335,70), 90, 90), null, Color.White, 0, new Vector2(45, 45), SpriteEffects.None, 0); } }
public void Draw(SpriteBatch spriteBatch, font Font, Extra extra) { spriteBatch.Draw(BGPic, new Rectangle(0, 0, 1100, 720), Color.White); spriteBatch.DrawString(Font.SelectionFont, "Move On", new Vector2(35, 400), Color.Red); spriteBatch.DrawString(Font.SelectionFont, "Endless Mode", new Vector2(35, 430), Color.Red); spriteBatch.Draw(extra.NimbusPic, extra.NimbusRect, Color.White); }
public void Draw(SpriteBatch spriteBatch, Vector2 position, SpriteFont font) { Queue<TraversalInformation> queue = new Queue<TraversalInformation>(); queue.Enqueue(new TraversalInformation(Root, 0)); TraversalInformation current; int positionCorrection = 24; int i = -1; while (queue.Count > 0) { current = queue.Dequeue(); spriteBatch.DrawString(font, current.DebugTreeNode.Context + ":", position + new Vector2(current.Level * positionCorrection, ++i * positionCorrection), Color.White); if ((current.DebugTreeNode.DebugEvent != null) && (current.DebugTreeNode.Collapsstate)) { spriteBatch.DrawString(font, current.DebugTreeNode.Value, position + new Vector2((current.Level + 1) * positionCorrection, ++i * positionCorrection), Color.White); } foreach (DebugTreeNode child in current.DebugTreeNode.Children) { queue.Enqueue(new TraversalInformation(child, 1 + current.Level)); } } }
public void Draw(SpriteBatch spriteBatch) { spriteBatch.DrawString(font, "Score: " + Score, scorePosition, Color.Black); spriteBatch.DrawString(font, "HP: ", healthPosition, Color.Black); spriteBatch.Draw(healthOutline, healthOutlinePosition, Color.White); spriteBatch.Draw(healthBar, healthBarSize, Color.White); }
public override void Draw(SpriteBatch spriteBatch) { var offset = 11 + Index*(26 + (int) _font.MeasureString(Text.Value).X); if (GameProvider.GameInstance.GetService<InputSystem>().GamePad.IsConnected()) { spriteBatch.Draw(GetTexture(), new Rectangle(offset, GameProvider.GameInstance.ScreenBounds.Height - 48, 32, 32), _highlightColor); offset += 32; } else { int boxWidth = 32; string displayString = KeyboardKey.ToString(); if (_font.MeasureString(displayString).X + 10 > 32) { boxWidth = (int)(_font.MeasureString(displayString).X + 10); } GameProvider.GameInstance.GetService<ShapeRenderer>().DrawRectangle(new Rectangle(offset, GameProvider.GameInstance.ScreenBounds.Height - 48, boxWidth, 32), _highlightColor, filled: false); spriteBatch.DrawString(_font, displayString, new Vector2(offset + 5, GameProvider.GameInstance.ScreenBounds.Height - 48), _highlightColor); offset += boxWidth; } spriteBatch.DrawString(_font, Text.Value, new Vector2(offset + 10, GameProvider.GameInstance.ScreenBounds.Height - 48), _highlightColor); }
internal void UpdateAndDraw(double a_elapsedTimeTotalSeconds, SpriteBatch m_spriteBatch, Camera m_camera, float displaceMentY) { for (int i = 0; i < MAX_PARTICLES; i++)//Går igenom alla partiklar { //Update particle speed and position m_particles[i].Update(a_elapsedTimeTotalSeconds); //Get view coordinates of particle Vector2 particleModelPositions = m_particles[i].getPosition(); Vector2 viewCoordinates = m_camera.translateCoordinates(m_particles[i].getPosition(), 960, 640, displaceMentY); //Create destination rectangle Rectangle dest = new Rectangle((int)viewCoordinates.X, (int)viewCoordinates.Y, 10, 10); Rectangle dest2 = new Rectangle(320,450, 32, 32); //Print particle m_spriteBatch.Draw(m_particle, dest, Color.White); m_spriteBatch.DrawString(font, "Particle 1 Y: " + viewCoordinates.Y.ToString(), new Vector2(240, 500), Color.White); m_spriteBatch.DrawString(font, "Particle 1 X: " + viewCoordinates.X.ToString(), new Vector2(240, 540), Color.White); } }
public void Draw(SpriteBatch sb) { Vector2 StartLen = StartFont.MeasureString(Start); sb.DrawString(StartFont, Start, new Vector2(Game.Window.ClientBounds.Width / 2 - StartLen.X / 2, Game.Window.ClientBounds.Height / 2 - StartLen.Y / 2), Color.White); Vector2 SettingsLen = StartFont.MeasureString(Settings); sb.DrawString(StartFont, Settings, new Vector2(Game.Window.ClientBounds.Width / 2 - SettingsLen.X / 2, Game.Window.ClientBounds.Height / 2 + SettingsLen.Y), Color.White); }
public void Draw(SpriteBatch spriteBatch) { bool hover = false; float x = (float)Mouse.GetState().X; MouseState state = Mouse.GetState(); Vector2 MousePos = new Vector2(x, (float)state.Y); if (HelperFunctions.CheckIntersection(this.r, MousePos)) { hover = true; } if (hover) { Primitives2D.FillRectangle(spriteBatch, this.r, new Color(128, 87, 43, 50)); } foreach (DropDownMenu.RecTexPair r in this.container) { spriteBatch.Draw(ResourceManager.TextureDict[r.tex], r.r, Color.White); } if (hover) { spriteBatch.DrawString(Fonts.Arial12Bold, this.Options[this.ActiveIndex], new Vector2((float)(this.r.X + 8), (float)(this.r.Y + this.r.Height / 2 - Fonts.Arial12Bold.LineSpacing / 2)), Color.White); return; } spriteBatch.DrawString(Fonts.Arial12Bold, this.Options[this.ActiveIndex], new Vector2((float)(this.r.X + 8), (float)(this.r.Y + this.r.Height / 2 - Fonts.Arial12Bold.LineSpacing / 2)), new Color(255, 239, 208)); }
public override void Draw(GameTime gameTime, SpriteBatch spriteBatch) { // Draw the background. spriteBatch.Draw(bgTexture, new Vector2(197.0f, 0.0f), Color.White); // Draw the "High Scores" title. spriteBatch.DrawString(highScoreFont, "High Scores", new Vector2(225.0f, 155.0f), Color.Black); // If there are no scores to display, draw a message saying so. if (scoreEntries.Count == 0) { spriteBatch.DrawString(highScoreFont, "No scores yet!", new Vector2(225.0f, 200.0f), Color.White); } // Draw the high-score entries. Color scoreColor; HighScore entry; for (int i = 0; i < scoreEntries.Count; ++i) { entry = scoreEntries[i]; scoreColor = (entry.Id.Equals(highlightedScoreId)) ? Color.White : Color.Black; spriteBatch.DrawString(highScoreFont, entry.Name, new Vector2(225.0f, boardYPos + i * boardYSep), scoreColor); spriteBatch.DrawString(highScoreFont, entry.Score.ToString(), new Vector2(510.0f, boardYPos + i * boardYSep), scoreColor); } }
public override void Draw(SpriteBatch spriteBatch) { if (HasFocus) spriteBatch.DrawString(SpriteFont, Text, Position, SelectedColor); else spriteBatch.DrawString(SpriteFont, Text, Position, Color); }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch) { //spriteBatch.Draw(background, Vector2.Zero, Color.White); spriteBatch.Draw(background, new Vector2(0, -5), null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f); /* spriteBatch.Draw(player, playerPosition, null, Color.White, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.0f);*/ hero.Draw(gameTime, spriteBatch); spriteBatch.DrawString(damageStringFont, damageNumber+" ", fPos, Color.White); spriteBatch.DrawString(damageStringFont, " /"+health, fPos, Color.White); playButton.Draw(gameTime, spriteBatch); }
/// <summary> /// Drawing the background and if active show a cursor so you know to type. /// </summary> /// <param name="spriteBatch"></param> public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(texture, bounds, Color.Black); spriteBatch.DrawString(fonts[1], input, new Vector2(bounds.X, bounds.Y), Color.White); if (typing) spriteBatch.DrawString(fonts[1], "|", new Vector2(bounds.X + (int)fonts[1].MeasureString(input).X + 1, bounds.Y), Color.White); }
public override void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(TitleScreenTexture, Vector2.Zero, null, backgroundCurrentColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f); spriteBatch.Draw(TitleTextJapanese, Vector2.Zero, null, text1CurrentColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, .9f); spriteBatch.Draw(TitleTextEnglish, Vector2.Zero, null, text2CurrentColor, 0f, Vector2.Zero, 1f, SpriteEffects.None, .8f); if(!HelpShown && !CreditsShown) spriteBatch.DrawString(titlescreenFont, "Press ENTER to begin", new Vector2((925f / 2f) - (titlescreenFont.MeasureString("Press ENTER to begin").X / 2f), 500), startTextColor); if (fadephase == 2 && !HelpShown && !CreditsShown) { spriteBatch.DrawString(titlescreenFont, "Press C for credits", new Vector2((925f) - (titlescreenFont.MeasureString("Press C for credits").X + 30), 605), Color.Gray); spriteBatch.DrawString(titlescreenFont, "Press H for help", new Vector2((925f) - (titlescreenFont.MeasureString("Press H for help").X + 30), 620), Color.Gray); } if (HelpShown) { spriteBatch.Draw(HelpTexture, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } else if (CreditsShown) { spriteBatch.Draw(CreditsTexture, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); } spriteBatch.DrawString(titlescreenFont, cheatText, new Vector2((925f / 2f) - (titlescreenFont.MeasureString(cheatText).X / 2f), 600), cheatTextCurrentColor); }
public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(texture, position, Color.White); spriteBatch.DrawString(Globals.font, header, new Vector2(position.X + 10, position.Y + 5), Color.White); Vector2 v = new Vector2(position.X + (texture.Width / 2), position.Y + (texture.Height / 2)); spriteBatch.DrawString(Globals.font, message, v, Color.White); }
public void draw(SpriteFont font, SpriteBatch batch, Texture2D score, Texture2D health) { batch.DrawString(font, hudScore, hudPosition, Color.White); batch.DrawString(font, hudHealth, new Vector2(hudPosition.X + 270, hudPosition.Y), Color.White); batch.Draw(score, new Vector2(hudPosition.X - 20, hudPosition.Y - 16), Color.White); batch.Draw(health, new Vector2(hudPosition.X + 220, hudPosition.Y - 17), Color.White); }
public void draw(SpriteBatch sb) { string content; Color color; Vector2 size; sb.Begin(); sb.Draw(NormalVariant.skygrad, new Rectangle(0, 0, (int)(Switcher.size.X), (int)(Switcher.size.Y)), null, Color.White); content = "Normal Mode"; color = (menuIndex == 0) ? Color.Red : Color.White; size = font.MeasureString(content); sb.DrawString(font, content, (Switcher.size - size) / 2 - new Vector2(0, Switcher.size.Y / 6), color); content = "Alternate Mode"; color = (menuIndex == 1) ? Color.Red : Color.White; size = font.MeasureString(content); sb.DrawString(font, content, (Switcher.size - size) / 2, color); content = "LOL Mode"; color = (menuIndex == 2) ? Color.Red : Color.White; size = font.MeasureString(content); sb.DrawString(font, content, (Switcher.size - size) / 2 + new Vector2(0, Switcher.size.Y / 6), color); content = "Time Mode"; color = (menuIndex == 3) ? Color.Red : Color.White; size = font.MeasureString(content); sb.DrawString(font, content, (Switcher.size - size) / 2 + new Vector2(0, Switcher.size.Y / 3), color); sb.End(); }
public void DrawString(string text, float x, float y, float rotation, Color c) { if (font == null) { throw new RuntimeException("Did not set any Font !"); } else { Vector2 pos = new Vector2(x, y); if (rotation != 0) { float centerX = font.StringWidth(text) / 2; float centerY = font.StringHeight(text) / 2; Vector2 origin = new Vector2(centerX, centerY); batch.DrawString( font.Font, text, pos, c, rotation, origin, 1f, SpriteEffects.None, 0); } else { batch.DrawString(font.Font, text, pos, c); } } }
public static void Draw(SpriteBatch spriteBatch) { //Draw the background background.Draw(spriteBatch); //Draw example ShopScreen.DrawExample(spriteBatch); //Draw the infobox infoBox.Draw(spriteBatch); if (InfoPacket.PlayerStatistics[(int)ShopScreen.ShopUser].HasCar[currentlySelected]) { spriteBatch.DrawString(boxFont, "Maximum Speed: " + ShopScreen.ExampleCar.MaxSpeed * 10 + "\n" + "Acceleration: " + ShopScreen.ExampleCar.MaxAcceleration * 10 + "\n" + "Damage: " + ShopScreen.ExampleCar.DamageFactor + "\n" + "Health: " + ShopScreen.ExampleCar.MaxHealth + "\n" + "Cost: OWNED! :D", new Vector2(60, 220), Color.Black); } else { spriteBatch.DrawString(boxFont, "Maximum Speed: " + ShopScreen.ExampleCar.MaxSpeed * 10 + "\n" + "Acceleration: " + ShopScreen.ExampleCar.MaxAcceleration * 10 + "\n" + "Damage: " + ShopScreen.ExampleCar.DamageFactor + "\n" + "Health: " + ShopScreen.ExampleCar.MaxHealth + "\n" + "Cost: " + cost, new Vector2(60, 220), Color.Black); } }
public void Draw(SpriteBatch theSpriteBatch) { theSpriteBatch.Draw(background, this.Position + new Vector2((period) * background.Width, 0), new Rectangle(0, 0, background.Width, background.Height), this.Color, this.Rotation, Vector2.Zero, 1.0f, SpriteEffects.None, 0); theSpriteBatch.Draw(background, this.Position + new Vector2((period + 1) * background.Width, 0), new Rectangle(0, 0, background.Width, background.Height), this.Color, this.Rotation, Vector2.Zero, 1.0f, SpriteEffects.None, 0); theSpriteBatch.DrawString(font, string.Format("Level: {0}", this.period), new Vector2(702, 4), Color.Black); theSpriteBatch.DrawString(font, string.Format("Level: {0}", this.period), new Vector2(700, 4), Color.LightGray); }
public virtual void DebugDraw(SpriteBatch spriteBatch) { // object debug info spriteBatch.DrawString( spriteFont: AssetRepository.Instance.Arial, text: owner.Health + "/" + owner.Health.MaxValue, position: PositionAboveHead(25), color: Color.White, rotation: 0f, origin: Vector2.Zero, scale: 1f, effects: SpriteEffects.None, depth: 1f ); spriteBatch.DrawString( spriteFont: AssetRepository.Instance.Arial, text: owner.DisplayName, position: PositionAboveHead(50), color: Color.White, rotation: 0f, origin: Vector2.Zero, scale: 1f, effects: SpriteEffects.None, depth: 1f ); }
public static void Draw(GameTime gameTime, Texture2D texture, SpriteBatch batch) { // DRAW SCORE var rectGear = new Rectangle(448, 640, 64, 64); batch.Draw(texture, new Vector2(0, 0), rectGear, Color.Goldenrod); var score = String.Format("x{0}", Game1.player.GearCount); batch.DrawString(Game1.font, score, new Vector2(64, 0), Color.Black); int i = 0; batch.DrawString(Game1.font, " GAME OVER ", new Vector2(100, 50 * i++), Color.Black); batch.DrawString(Game1.font, "Students: Ben Branch", new Vector2(100, 50 * i++), Color.White); batch.DrawString(Game1.font, " Addison Denchik", new Vector2(100, 50 * i++), Color.White); batch.DrawString(Game1.font, " Joshua Gold", new Vector2(100, 50 * i++), Color.White); batch.DrawString(Game1.font, " Aaron Kimbrell", new Vector2(100, 50 * i++), Color.White); batch.DrawString(Game1.font, " Micki Salkin", new Vector2(100, 50 * i++), Color.White); batch.DrawString(Game1.font, "Counselors: Laynie Boland", new Vector2(100, 50 * i++), Color.White); batch.DrawString(Game1.font, " Derek Garde", new Vector2(100, 50 * i++), Color.White); batch.DrawString(Game1.font, "Instructor: Joseph Hall", new Vector2(100, 50 * i++), Color.White); Vector2 origin = new Vector2(64, 0); float rotate = MathHelper.ToRadians(-90); Vector2 locDeadGuy = new Vector2(250,0); Rectangle rectStanding = new Rectangle(128, 512, 64, 128); batch.Draw(texture, locDeadGuy, rectStanding, Color.White, rotate, origin, 1, SpriteEffects.None, 0); }
public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); map.Draw(spriteBatch, "Underlay"); player.Draw(spriteBatch); map.Draw(spriteBatch, "Overlay");//overlay AFTER the player (on top) spriteBatch.DrawString(font, "" + popup, new Vector2(0, 0), Color.Black); spriteBatch.DrawString(font, "\n" + (int)player.Image.Position.X, new Vector2(0, 0), Color.Black); spriteBatch.DrawString(font, "\n\n" + (int)player.Image.Position.Y, new Vector2(0, 0), Color.Black); if (popup == new Vector2(128, 192)) if (Enumerable.Range((int)player.Image.Position.X - 10, (int)player.Image.Position.X + 5).Contains((int)popup.X) && Enumerable.Range((int)player.Image.Position.Y - 10, (int)player.Image.Position.Y + 10).Contains((int)popup.Y)) { spriteBatch.Draw(texturebg, new Rectangle(0, 400, 640, 80), Color.White); spriteBatch.DrawString(font, "And everything has died...", new Vector2(0, 400), Color.Black); if (one == 0) { paper.Play(); one = 1; } popup = Vector2.Zero; } else one = 0; }
public void Draw(SpriteBatch sb) { Rectangle vp = sb.GraphicsDevice.Viewport.Bounds; sb.Draw(hudTex, new Vector2(vp.Width - 240, 18), new Rectangle(319,0,230,236), Color.White); sb.Draw(hudTex, new Vector2(vp.Width - 238, 120 - (int)huntedLevel), new Rectangle(550, 2 + (100 - (int)huntedLevel), 16, (int)huntedLevel*2), Color.White, 0f, new Vector2(0,0), 1f, SpriteEffects.None, 1); sb.DrawString(hudFont, "Day " + day, new Vector2(vp.Width - 216, 221), Color.White); sb.DrawString(hudFont, timeOfDay.Hour.ToString("00") + ":" + timeOfDay.Minute.ToString("00"), new Vector2(vp.Width - 24 - hudFont.MeasureString(timeOfDay.Hour.ToString("00") + ":" + timeOfDay.Minute.ToString("00")).X, 221), Color.White); sb.Draw(hudTex, new Vector2(30, 28), new Rectangle(vehicle?50:0, 150, 50, 50), Color.White, 0f, new Vector2(25, 25), 1f, SpriteEffects.None, 1); sb.Draw(hudTex, new Vector2(30, 28 +26), new Rectangle(weapon * 50, 100, 50, 50), Color.White, 0f, new Vector2(25, 25), 1f, SpriteEffects.None, 1); sb.Draw(hudTex, new Vector2(68, 18), new Rectangle(0, 0, 310, 25), Color.White); sb.Draw(hudTex, new Vector2(70, 20), new Rectangle(2, 54, (int)((float)(300f/100f) * heroHealth), 16), vehicle?Color.Green:Color.Red); //if (showAmmo) //{ sb.Draw(hudTex, new Vector2(68, 18 + 26), new Rectangle(0, 26, 310, 25), Color.White * (showAmmo?1f:0.3f)); sb.Draw(hudTex, new Vector2(70, 20 + 26), new Rectangle(0, 71, ammo * 3, 16), Color.White * (showAmmo ? 1f : 0.3f)); //} Ticker.Draw(sb, hudFont, new Vector2(20, 70)); }
public override void Draw(SpriteBatch batch) { batch.Draw(image, new Rectangle(287, 110, 460, y_spacing * (3) + 10), Color.Gray); batch.Draw(image, new Rectangle(292, 115, 450, y_spacing * (3)), Color.Black); batch.DrawString(font, title, new Vector2(292, 115), teamColor); batch.Draw(image, new Rectangle(x_position - 5, y_position - 5, 410, y_spacing * (menuitems.Count) + 10), Color.Gray); batch.Draw(image, new Rectangle(x_position, y_position, 400, y_spacing * (menuitems.Count)), Color.Black); batch.DrawString(font, "Rules List:", new Vector2(x_position, y_position), Color.Gold); batch.DrawString(font, "(X)", new Vector2(372, 140), Color.Blue); foreach (MenuItem x in menuitems) { int i = menuitems.IndexOf(x); if (i == 0) x.Draw(batch, font, 412, 140); else if (x==current) x.Draw(batch, font, x_position + (i + 1) * x_spacing + 15, y_position + y_spacing * (i)); else x.Draw(batch, font, x_position + (i + 1) * x_spacing, y_position + y_spacing * (i)); } batch.Draw(image, new Rectangle(x_position - 5 + 500, y_position - 5, 410, y_spacing * (judgementItems.Count) + 10), Color.Gray); batch.Draw(image, new Rectangle(x_position + 500, y_position, 400, y_spacing * (judgementItems.Count)), Color.Black); batch.DrawString(font, "Judgement List:", new Vector2(x_position + 500, y_position), Color.Gold); foreach (MenuItem x in judgementItems) { int i = judgementItems.IndexOf(x); if (i == 0) x.Draw(batch, font, 412, 140); else if (x == current) x.Draw(batch, font, x_position + 500 + (i + 1) * x_spacing + 15, y_position + y_spacing * (i)); else x.Draw(batch, font, x_position + 500 + (i + 1) * x_spacing, y_position + y_spacing * (i)); } }
public void Draw(SpriteBatch spriteBatch, Extras extra) { spriteBatch.Draw(BG, new Rectangle(0, 0, 1080, 720), Color.White); spriteBatch.DrawString(extra.TitleFont, "Welcome To ToonFight!", new Vector2(10, 05), Color.White); spriteBatch.DrawString(extra.NormalFont, "[Load Toon]", new Vector2(600, 500), Color.White); spriteBatch.DrawString(extra.NormalFont, "[New Toon]", new Vector2(600, 530), Color.White); }
public void Draw(GameTime gameTime, SpriteBatch spriteBatch) { spriteBatch.Draw(background, Vector2.Zero, null, Color.White, 0.0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0.0f); hero.Draw(gameTime, spriteBatch); support1.Draw(gameTime, spriteBatch); spriteBatch.DrawString(damageStringFont, damageNumber+ " Press S for Link and Down for Ganondorf",new Vector2(0, 0), Color.Red); spriteBatch.DrawString(damageStringFont, damageNumber2 + "", new Vector2(910, 0), Color.Red); if (damageNumber >= 500) { spriteBatch.DrawString(damageStringFont, "Ayy Lmao Bugan Player 1 wins!!!!", new Vector2(300, 130), Color.Pink); } if (damageNumber2 >= 500) { spriteBatch.DrawString(damageStringFont, "Ayy Lmao Bugan Player 2 wins!!!!", new Vector2(300, 130), Color.Pink); } //playButton.Draw(gameTime, spriteBatch); }
public override void Draw(SpriteBatch s, Vector2 relativePosition) { Vector2 pos = relativePosition + Position; s.Draw(_texture, pos, Color.White); s.DrawString(_spriteFont, _name, pos + new Vector2(10,7+35), Color.White); if (_dropdownDown) { if (_option2 != "") { s.Draw(_arrows, pos + new Vector2(-32 - 16, _texture.Height), Color.White); s.Draw(_texture, pos + new Vector2(-32 - 16 - 1, _texture.Height + 32), Color.White); s.DrawString(_spriteFont, _option1, pos + new Vector2(-32 - 16 - 1 + _texture.Width / 2 - _spriteFont.MeasureString(_option1).X / 2, _texture.Height + 32 + 20), Color.White); s.Draw(_texture, pos + new Vector2(-32 - 16 + 96 + 1, _texture.Height + 32), Color.White); s.DrawString(_spriteFont, _option2, pos + new Vector2(-32 - 16 + 96 + 1 + _texture.Width / 2 - _spriteFont.MeasureString(_option2).X / 2, _texture.Height + 32 + 20), Color.White); } else if (_option1 != "") { s.Draw(_arrowDown, pos + new Vector2(-32 - 16, _texture.Height), Color.White); s.Draw(_texture, pos + new Vector2(0, _texture.Height + 32), Color.White); s.DrawString(_spriteFont, _option1, pos + new Vector2( _texture.Width / 2 - _spriteFont.MeasureString(_option1).X / 2, _texture.Height + 32 + 20), Color.White); } } base.Draw(s, relativePosition); }
public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(TextureHealth, RectangleHealth, Color.White); spriteBatch.Draw(TextureTestos, RectangleTestos, Color.White); spriteBatch.DrawString(Text, HealthText + Stats.Potions, new Vector2(PositionHealth.X + 2, 6), Color.Black); spriteBatch.DrawString(Text, TestosText, new Vector2(PositionTestos.X + 2, 31), Color.Black); }
public void Draw(SpriteBatch spriteBatch) { var position = new Vector2(XnaDartsGame.Viewport.Width*0.5f, XnaDartsGame.Viewport.Height*0.125f); var font = ScreenManager.Trebuchet24; float ppd; var thrown = _mode.CurrentPlayer.Rounds.Sum(r => r.Darts.Count); float totalScore = _mode.CurrentPlayer.Rounds.Sum(r => _mode.GetScore(r)); if (thrown > 0) { ppd = totalScore/thrown; } else { ppd = 0; } var text = "Points Per Dart: " + ppd.ToString("0.00"); var offset = font.MeasureString(text)*0.5f; spriteBatch.DrawString(font, text, position - offset + Vector2.One, Color.Black); spriteBatch.DrawString(font, text, position - offset, Color.White); //Draw points per round var ppr = totalScore/(_mode.CurrentRoundIndex + 1); position.Y += offset.Y*2.0f + 10.0f; text = "Points Per Round: " + ppr.ToString("0.00"); offset = font.MeasureString(text)*0.5f; spriteBatch.DrawString(font, text, position - offset + Vector2.One, Color.Black); spriteBatch.DrawString(font, text, position - offset, Color.White); }
public void Draw(Microsoft.Xna.Framework.GameTime gametime, Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch) { spritebatch.Begin(); spritebatch.Draw(background, Vector2.Zero, Color.White); nukes.Draw(spritebatch); nukes.Particle_Draw(spritebatch); spritebatch.Draw(clouds, Vector2.Zero, Color.White); buildings.Draw(spritebatch); spritebatch.Draw(Billboard, Vector2.Zero, Color.White); switch (MenuSwitch) { case Menu_Switch.HighScore: { int y = 0; foreach (HighScores.Score s in highScores.Scores) { menu.SpriteBatch(spritebatch); spritebatch.DrawString(font, s.ToString(), new Vector2(100, 100 + (y * 20)), Color.Black); y += 1; if (y > 20) { y = 0; } } } break; case Menu_Switch.Logo: if (Logo != null) { spritebatch.Draw(Logo[logo_Value], new Vector2(75, 80), Color.White); } break; case Menu_Switch.MainMenu: Start.SpriteBatch(spritebatch); Help.SpriteBatch(spritebatch); Quit.SpriteBatch(spritebatch); Highscores.SpriteBatch(spritebatch); spritebatch.Draw(Title, new Vector2(400, 20), null, new Color(255, 255, 255, Menu_Alpha), 0.0f, new Vector2(200, 0), 0.9f, SpriteEffects.None, 0); spritebatch.DrawString(font, credits, new Vector2(0, credit_Y), Color.Black); break; case Menu_Switch.Help: spritebatch.Draw(Help_front, new Vector2(51, 50), Color.White); menu.SpriteBatch(spritebatch); break; } spritebatch.Draw(Lights_Billboard, Vector2.Zero, Color.White); spritebatch.End(); }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { spriteBatch.DrawString(this.TextFont, this.HeaderText, this.Position, this.TextColor); float offset = this.TextFont.MeasureString(this.HeaderText).Y; float textheigth = this.TextFont.MeasureString("A").Y; foreach (string row in TextRows) { var textPosition = new Vector2(this.Position.X, this.Position.Y + offset); spriteBatch.DrawString(this.TextFont, row, textPosition, this.TextColor); offset += textheigth; } }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { foreach (MenuItem item in _menuItems) { spriteBatch.DrawString(_font, item.Text, item.Position, item.IsSelected ? Color.GreenYellow : Color.Red); } }
public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager g, ref Microsoft.Xna.Framework.Graphics.SpriteFont font) { sp.Begin(); /// Logic for drawing the ActiveBackground ActiveBackground.DrawSky(); ActiveBackground.DrawSunrays(); ActiveBackground.DrawFlowers(); ActiveBackground.DrawGrass(); ActiveBackground.DrawSun(); ActiveBackground.DrawCloud1(); ActiveBackground.DrawCloud2(); ActiveBackground.DrawCloud3(); ActiveBackground.DrawCloud4(); ActiveBackground.DrawCloud5(); // Draws the Background-Image // sp.Draw(background, new Rectangle(0, 0, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height), Color.White); // Draws the player-picture in question to detailview // sp.Draw(player_picture, detailPictureOutlines, Color.White); sp.Draw(player_picture, new Rectangle((int)(bZero * 0.300), (int)(hZero * 0.200), (int)(bZero * 0.400), (int)(hZero * 0.600)), Color.White); // Draws the caption in the Topleft-Corner // sp.DrawString(font, "Detailview - Click anywhere to return", new Vector2(20, 20), Color.Black); // Draws the caption that tells the player how to return to the highscore-tablescreen sp.DrawString(font, "Click on the Background to return", new Vector2((int)(bZero * 0.300), 40), Color.White); sp.End(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb) { sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, _rasterizerScissorsState); sb.Draw(frameText, new Rectangle(X, Y, width, height), Color.White); //if (new Rectangle(X, Y, width, height).Contains((int)GUI.InputManager.MousePosition.X, (int)GUI.InputManager.MousePosition.Y)) // if(GUI.InputManager.MouseManager.State.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed) // sb.Draw(backText, ClientArea, Color.Gray); // else // sb.Draw(backText, ClientArea, Color.LightGray); //else sb.Draw(backText, ClientArea, topColor); topColor = Color.White; Rectangle oldsc = sb.GraphicsDevice.ScissorRectangle; sb.GraphicsDevice.ScissorRectangle = ClientArea; sb.DrawString(Parent.Font, drawText, new Vector2(ClientArea.X + 3, ClientArea.Y + 3 - text_y_scroll), Color.Black); //, 0, Vector2.Zero, 1f, SpriteEffects.None, 0); //sb.DrawString(font, drawString, new Vector2(destination.X, destination.Y - yoffset), color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0); sb.GraphicsDevice.ScissorRectangle = oldsc; sb.End(); }
public override void Draw(Microsoft.Xna.Framework.GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { var drawLocation = this.GetAbsoluteLocation(BufferWidth); var x = drawLocation.X; var y = drawLocation.Y; // Draw Text for (int i = 0; i < Text.Count - drawStart; i++) { if (i + drawStart != SelectedItem) { spriteBatch.DrawString(Font, Text[(i + drawStart)], new Vector2(x, y + _cellHeight * i), NormalColor); } if (_cellHeight * (i + 1) > this.TextZoneSize.Height) { break; } } // Highlight Selection DrawText(spriteBatch, Font, Text[SelectedItem], new Vector2(x, y + _cellHeight * (SelectedItem - drawStart)), SelectionColor); base.Draw(time, spriteBatch); }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { base.Draw(gameTime, spriteBatch); spriteBatch.DrawString(scoreFont, score.ToString(), scorePos, Color.White); spriteBatch.Draw(homeTex, new Vector2(70.0f, 650.0f), Color.White); spriteBatch.Draw(replayTex, new Vector2(820.0f, 650.0f), Color.White); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb) { sb.Draw(texture, area, color); if (state) { sb.Draw(checkTexture, area, color); } sb.DrawString(Fonts.Arial, name, labelPos, color); }
public override void draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb) { base.draw(sb); sb.Begin(); Vector2 pos = new Vector2(300, 50); if (myTemp.Seconds >= 10) { sb.DrawString(myFont, ("Time Left: " + myTemp.Minutes + ":" + myTemp.Seconds), pos, Color.Black); } else { sb.DrawString(myFont, ("Time Left: " + myTemp.Minutes + ":" + 0 + myTemp.Seconds), pos, Color.Black); } sb.End(); //base.draw(sb); }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { string cameraPositionString = "CAM: " + _cameraXAxis.ToString("0") + " - " + _cameraYAxis.ToString("0"); var font = _fontService.GetDefaultFont(); Vector2 size = font.MeasureString(cameraPositionString); Vector2 pos = new Vector2(120f, 500f); Vector2 origin = size * 0.5f; spriteBatch.DrawString(font, cameraPositionString, pos, Color.LightGreen); }
public void Draw(Microsoft.Xna.Framework.GameTime gameTime, ref Microsoft.Xna.Framework.Graphics.SpriteBatch sp, ref Microsoft.Xna.Framework.GraphicsDeviceManager graphics, ref Microsoft.Xna.Framework.Graphics.SpriteFont font) { sp.Begin(); g.Clear(Color.Black); /// Logic for drawing the ActiveBackground ActiveBackground.DrawSky(); ActiveBackground.DrawSunrays(); ActiveBackground.DrawFlowers(); ActiveBackground.DrawGrass(); ActiveBackground.DrawSun(); ActiveBackground.DrawCloud1(); ActiveBackground.DrawCloud2(); ActiveBackground.DrawCloud3(); ActiveBackground.DrawCloud4(); ActiveBackground.DrawCloud5(); // Draws the Background-Image // sp.Draw(background, new Rectangle(0, 0, bZero, hZero), Color.White); // Top-Left corner caption // sp.DrawString(font, "Endgame", new Vector2(20, 20), Color.White); // The Scoreboard sp.DrawString(GameSpecs.scoreFont, Convert.ToInt32(Timer.Score).ToString(), new Vector2((int)(bZero * 0.38), (int)(hZero * 0.011)), Color.OrangeRed); // The Placeholder-graphic for the KinectStream sp.Draw(placeholder, new Rectangle((int)(bZero * 0.300), (int)(hZero * 0.200), (int)(bZero * 0.400), (int)(hZero * 0.600)), Color.White); // The Countdown for taking the photo sp.DrawString(GameSpecs.scoreFont, Math.Round(Countdown.Counter).ToString(), new Vector2((float)(bZero / 2) - 80, (float)(hZero - 160)), Color.Turquoise); if (Session.PhotoTaken == true) { // Draw the Button(s) foreach (Button btn in bl) { sp.Draw(btn.Texture, btn.Position, btn.SourceRectangle, btn.Color, btn.Rotation, btn.Origin, btn.Scale, btn.Effect, btn.LayerDepth); } } sp.End(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch Sb, Graphics.PrimitiveRenderer Pr) { Sb.Begin(); StringBuilder str = new StringBuilder(); str.AppendLine("Accent"); str.AppendLine("Press 'space' to start!"); Sb.DrawString(sysFont, str, titlePos, Color.White); Sb.End(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite) { sprite.Begin(); for (int i = 0; i < 5; i++) { sprite.DrawString(fuente, mensajes[i], posicionMensaje[i], new Color(0, 0, 0, transparencia[i])); } //sprite.DrawString(); sprite.End(); //base.Draw(sprite); }
public void Draw(Microsoft.Xna.Framework.GameTime gameTime, Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { _framesCounter++; spriteBatch.DrawString( _bitmapFont, text: $"FPS: {FramesPerSecond:0}", position: Vector2.One, color: Color.Goldenrod ); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite) { colorActual = new Color(0, 0, 0, 20); base.posicion = new Vector2((anchoVentana - (anchoMensaje / 2) / 2), 100 /*(((altoVentana) - altoMensaje) / 2) - altoMensaje*/); sprite.Begin(); crearSombra(sprite); colorActual = Color.Silver; efecto(sprite); sprite.DrawString(base.Fuente, base.Texto, base.Posicion, new Color(Red, Green, Blue)); sprite.End(); //base.Draw(sprite); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch Sb, Graphics.PrimitiveRenderer Pr) { StringBuilder str = new StringBuilder(); if (Left.Damage == Right.Damage) { str.AppendLine("Draw!"); } else { str.Append("Winrar: "); if (Left.Damage < Right.Damage) { str.AppendLine("Player 1!"); } else { str.AppendLine("Player 2!"); } } str.AppendLine("Press Enter to return to track select..."); Sb.Begin(); Sb.DrawString(sysFont, str, resultsTextPosition, Color.White); str.Clear(); str.AppendLine("Player 1\n"); str.AppendFormat("Result score: {0}\n", Left.Score); str.AppendFormat("Final health: {0}\n", Left.Health); str.AppendFormat("Damage dealt: {0}\n", Left.Damage); Sb.DrawString(sysFont, str, LeftResultPosition, Color.White); str.Clear(); str.AppendLine("Player 2\n"); str.AppendFormat("Result score: {0}\n", Right.Score); str.AppendFormat("Final health: {0}\n", Right.Health); str.AppendFormat("Damage dealt: {0}\n", Right.Damage); Sb.DrawString(sysFont, str, RightResultPosition, Color.White); Sb.End(); }
public override void Draw(InterfaceLayer layer, Microsoft.Xna.Framework.Graphics.SpriteBatch sb) { Main.inventoryScale = 0.85f; Drawing.DrawBox(sb, startPx - 235, startPy + 39, 415, 160); //h was 130 sb.DrawString(Main.fontMouseText, "", new Vector2(startPx + 89, startPy + 3), Color.White); sb.DrawString(Main.fontMouseText, "", new Vector2(startPx + 53, startPy + 55), Color.White); sb.DrawString(Main.fontMouseText, "", new Vector2(startPx + 113, startPy + 55), Color.White); sb.DrawString(Main.fontMouseText, "", new Vector2(startPx + 12, startPy + 27), Color.White); sb.DrawString(Main.fontMouseText, "", new Vector2(startPx + 68, startPy + 27), Color.White); sb.DrawString(Main.fontMouseText, "", new Vector2(startPx + 127, startPy + 27), Color.White); itemSlot[0].UpdateAndDraw(sb, new Vector2(startPx - 223, startPy + 47), Main.inventoryScale); itemSlot[1].UpdateAndDraw(sb, new Vector2(startPx - 223, startPy + 97), Main.inventoryScale); itemSlot[2].UpdateAndDraw(sb, new Vector2(startPx - 223, startPy + 147), Main.inventoryScale); itemSlot[3].UpdateAndDraw(sb, new Vector2(startPx - 165, startPy + 47), Main.inventoryScale); itemSlot[4].UpdateAndDraw(sb, new Vector2(startPx - 165, startPy + 97), Main.inventoryScale); itemSlot[5].UpdateAndDraw(sb, new Vector2(startPx - 165, startPy + 147), Main.inventoryScale); itemSlot[6].UpdateAndDraw(sb, new Vector2(startPx - 107, startPy + 47), Main.inventoryScale); itemSlot[7].UpdateAndDraw(sb, new Vector2(startPx - 107, startPy + 97), Main.inventoryScale); itemSlot[8].UpdateAndDraw(sb, new Vector2(startPx - 107, startPy + 147), Main.inventoryScale); itemSlot[9].UpdateAndDraw(sb, new Vector2(startPx - 49, startPy + 47), Main.inventoryScale); itemSlot[10].UpdateAndDraw(sb, new Vector2(startPx - 49, startPy + 97), Main.inventoryScale); itemSlot[11].UpdateAndDraw(sb, new Vector2(startPx - 49, startPy + 147), Main.inventoryScale); itemSlot[12].UpdateAndDraw(sb, new Vector2(startPx + 9, startPy + 47), Main.inventoryScale); itemSlot[13].UpdateAndDraw(sb, new Vector2(startPx + 9, startPy + 97), Main.inventoryScale); itemSlot[14].UpdateAndDraw(sb, new Vector2(startPx + 9, startPy + 147), Main.inventoryScale); itemSlot[15].UpdateAndDraw(sb, new Vector2(startPx + 67, startPy + 47), Main.inventoryScale); itemSlot[16].UpdateAndDraw(sb, new Vector2(startPx + 67, startPy + 97), Main.inventoryScale); itemSlot[17].UpdateAndDraw(sb, new Vector2(startPx + 67, startPy + 147), Main.inventoryScale); itemSlot[18].UpdateAndDraw(sb, new Vector2(startPx + 125, startPy + 47), Main.inventoryScale); itemSlot[19].UpdateAndDraw(sb, new Vector2(startPx + 125, startPy + 97), Main.inventoryScale); itemSlot[20].UpdateAndDraw(sb, new Vector2(startPx + 125, startPy + 147), Main.inventoryScale); }
protected override void OnDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { string str = ((int)bossHp.HealthPercent).ToString() + "%"; if (bossHp.HealthPercent < 0f) { str = "0%"; } spriteBatch.DrawString(font, str, new Vector2(s.Position.X + s.Size.X / 2f - font.MeasureString(str).X / 2f, s.Position.Y - font.MeasureString(str).Y), Color.Red); s.Draw(spriteBatch); base.OnDraw(spriteBatch); }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch, GameStatus status) { char _blah; bool go = GameHelper.TryConvertKeyboardInput(Keyboard.GetState(), _oldstate, out _blah); _oldstate = Keyboard.GetState(); batch.Draw(_boxtexture, _textbox, Color.White); if (go) { _playertext += _blah; } batch.DrawString(status.Font, _playertext, new Vector2(30, 30), Color.Black); }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch drawer) { drawer.GraphicsDevice.Clear(new Microsoft.Xna.Framework.Color(0, 0, 200)); //TODO: make this customizeable if (font != null) { drawer.DrawString(font, message, new Microsoft.Xna.Framework.Vector2(100, 100), new Microsoft.Xna.Framework.Color(0, 0, 0)); } //TODO: center this probably //TODO: insert newlines if necessary? //TODO: probably also font color }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { spriteBatch.DrawString(spriteFont, header, FontPos, Color.White, 0, FindFontOrigin(header), 2.0f, SpriteEffects.None, 0.5f); float x = 100; float y = 50; foreach (Sprite sprite in sprites) { sprite.Draw(spriteBatch, new Vector2(x, y)); spriteBatch.DrawString(spriteFont, sprite.Element.Name, new Vector2(x + 50, y), Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); string score = "Score: " + sprite.Element.Score; spriteBatch.DrawString(spriteFont, score, new Vector2(x + 50 + (float)(Width / 5), y), Color.White, 0, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); y += (int)(Height * 0.0325520833); } if (GamePad.GetState(PlayerIndex.One).IsConnected) { if (selectedIndex == 0) { spriteBatch.Draw(selecter, new Rectangle((screenCenter.X - (startButton.Width / 2)), (int)(Height * 0.5859375), startButton.Width, startButton.Height), selectColor * 0.4f); } else if (selectedIndex == 1) { spriteBatch.Draw(selecter, new Rectangle((screenCenter.X - (startButton.Width / 2)), (int)(Height * 0.8463541667), startButton.Width, startButton.Height), selectColor * 0.4f); } } spriteBatch.Draw(startButton, new Rectangle(screenCenter.X - ((int)(Width * 0.146484375) / 2), (int)(Height * 0.5859375), (int)(Width * 0.146484375), (int)(Height * 0.09765625)), Color.White); spriteBatch.Draw(quitButton, new Rectangle(screenCenter.X - ((int)(Width * 0.146484375) / 2), (int)(Height * 0.8463541667), (int)(Width * 0.146484375), (int)(Height * 0.09765625)), Color.White); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sprite) { sprite.Begin(); for (int i = 0; i < numeroElementos; i++) { if (elementoActivo == i) { sprite.DrawString(base.Fuente, elementos[i].ToString(), new Vector2(rectangulosOpciones[i].X, rectangulosOpciones[i].Y), elementoSeleccionado); } else { sprite.DrawString(base.Fuente, elementos[i].ToString(), new Vector2(rectangulosOpciones[i].X, rectangulosOpciones[i].Y), elementonoSeleccionado); } } //sprite.DrawString(fuente, rectangulosOpciones[0].X.ToString()+" "+rectangulosOpciones[0].Y.ToString()+" "+rectangulosOpciones[0].Width+" "+rectangulosOpciones[0].Height, new Vector2(300, 100), Color.Black); //sprite.DrawString(fuente, rectangulosOpciones[1].X.ToString() + " " + rectangulosOpciones[1].Y.ToString() + " " + rectangulosOpciones[1].Width + " " + rectangulosOpciones[1].Height, new Vector2(300, 150), Color.Black); //sprite.DrawString(fuente, rectangulosOpciones[2].X.ToString() + " " + rectangulosOpciones[2].Y.ToString() + " " + rectangulosOpciones[2].Width + " " + rectangulosOpciones[2].Height, new Vector2(300, 200), Color.Black); //sprite.DrawString(fuente, rectangulosOpciones[3].X.ToString() + " " + rectangulosOpciones[3].Y.ToString() + " " + rectangulosOpciones[3].Width + " " + rectangulosOpciones[3].Height, new Vector2(300, 250), Color.Black); //sprite.DrawString(fuente, Mouse.GetState().X.ToString() + " " + Mouse.GetState().Y.ToString(), new Vector2(300, 300), Color.Black); sprite.End(); //base.Draw(sprite); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { NameBar.Draw(spriteBatch); graphicBox.Draw(spriteBatch); if (weapon != null) { graphic.Draw(spriteBatch); string fireGroupString = fireGroupChars[weapon.fireGroup].ToString(); spriteBatch.DrawString(Resources.Menus.SmallDisplayFont, "Fire: " + fireGroupString, new Vector2(graphicBox.dimensions.X + graphicBox.dimensions.Width - 64, graphicBox.dimensions.Y + graphicBox.dimensions.Height - 32), Color.Lime); } UpArrow.Draw(spriteBatch); DownArrow.Draw(spriteBatch); }
public override void Draw(GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { try { batch.DrawString(getFont(), getHP().ToString(), new Vector2(this.Geometry.Position.X + healthOffset.X, this.Geometry.Position.Y + healthOffset.Y), Color.Orange, 0.0f, Vector2.Zero, 3.0f, SpriteEffects.None, 0.0f); } catch (Exception) { } base.Draw(time, batch); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { //base.Draw(batch); for (int i = 0; i < textAtoms.Count; i++) { batch.DrawString( textAtoms[i].Font, textAtoms[i].Text, textAtoms[i].Origin + textAtoms[i].TopLeft + CurrentState.Position, textAtoms[i].Color, CurrentState.Rotation, CurrentState.Origin, CurrentState.Scale, se, .5f / DepthCounter++ ); } }
public void Draw(Microsoft.Xna.Framework.GameTime gametime, Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch) { spritebatch.Begin(); spritebatch.Draw(background, Vector2.Zero, Color.White); buildings.Back_Draw(spritebatch); nukes.Draw(spritebatch); spritebatch.End(); spritebatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Deferred, SaveStateMode.None); nukes.Particle_Draw(spritebatch); spritebatch.End(); spritebatch.Begin(); spritebatch.Draw(clouds, new Vector2(0, -250), Color.White); buildings.Draw(spritebatch); pause.Draw(spritebatch); spritebatch.DrawString(font, "Score:" + Score, Vector2.Zero, Color.Black); spritebatch.End(); }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch) { Texture2D border = GameEngine.GetInstance().ResourceManager.GetTexture("p"); spritebatch.Begin(); spritebatch.Draw(border, new Vector2(95, 50), null, Color.SaddleBrown * 0.5f, 0.0f, Vector2.Zero, new Vector2(200, 400), SpriteEffects.None, 0.0f); foreach (KeyValuePair <int, String> kvp in GameEngine.GetInstance().Client.ConnectedClients) { spritebatch.DrawString(font, kvp.Value.ToString(), new Vector2(110, 50 * kvp.Key), Color.White); } spritebatch.End(); spritebatch.Begin(); terrainGenerator.Draw(spritebatch, new Vector2(983, 200)); spritebatch.End(); gui.Draw(spritebatch); }
public override void Draw(GameTime time, Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { Screen screen; WorldScreen world; try { _Parent.Manager.LookupScreen("World", out screen); world = (WorldScreen)screen; //get weapon name /* * batch.DrawString(getFont(), world.Player.currentWeapon.getName(), * new Vector2(this.Geometry.Position.X + reloadOffset.X, * this.Geometry.Position.Y + reloadOffset.Y - 140), * Color.Red, * 0.0f, * Vector2.Zero, * 2.5f, * SpriteEffects.None, * 0.0f);*/ } catch {} if (bulletIndex == -1) { batch.DrawString(getFont(), "Reloading...", new Vector2(this.Geometry.Position.X + reloadOffset.X, this.Geometry.Position.Y + reloadOffset.Y), Color.Red, 0.0f, Vector2.Zero, 3.0f, SpriteEffects.None, 0.0f); } base.Draw(time, batch); }