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(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { String text = mode ? "True" : "False"; Color color = !GetSelected() ? colorA : colorB; Rectangle numRect = this.ToRectangle(); numRect.Width = boolWidth; Rectangle rect = this.ToRectangle(); this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + text + " ").X + 3) + boolWidth; rect.X += boolWidth; primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, color); primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, new Color(0x3D, 0x70, 0xBC)); Vector2 vector = this.GetVector(); vector.X += 3; vector.Y += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), " Bool ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); vector.X += boolWidth - 3; spriteBatch.DrawString(fontHandler.GetVerdana(), " " + text + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { Rectangle numRect = this.ToRectangle(); numRect.Width = strWidth; Rectangle rect = this.ToRectangle(); this.width = (rect.Width = (int)fontHandler.GetVerdana().MeasureString(" " + formatText(fontHandler) + " ").X + 3) + strWidth; rect.X += strWidth; if (this.text.Length > 0 || GetSelected()) if (selected) { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorB); } else { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, rect, colorA); } primitiveDrawer.DrawRoundedRectangle(graphicsDevice, numRect, storedColor); Vector2 vector = this.GetVector(); vector.X += 3; vector.Y += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), " Code ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); vector.X += strWidth; spriteBatch.DrawString(fontHandler.GetVerdana(), " " + formatText(fontHandler) + " ", vector + TetrisGameRunner.GetOffsetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); }
private void DrawAntrieb(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, Antrieb antrieb) { int x = (int)(GetPosition().X); int y = (int)(GetPosition().Y); sb.DrawString(UIButton.FONT_DEFAULT, antrieb.Name, new Vector2(padding + x, padding + y), Color.Black); sb.DrawString(UIButton.FONT_DEFAULT, "Schaden: " + antrieb.Damage + " Feuerrate: " + antrieb.RateOfFire, new Vector2(padding + x, padding + y + lineHeight), Color.Black); sb.DrawString(UIButton.FONT_DEFAULT, "Gewicht: " + antrieb.Weight, new Vector2(padding + x, padding + y + lineHeight * 2), Color.Black); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { batch.DrawString(ResourceManager.bauhaus, "Username", new Vector2(5, 10), Color.Orange); batch.DrawString(ResourceManager.bauhaus, "Score", new Vector2(ACWGame.WIDTH - 100 - scoreWidth, 10), Color.Orange); for (int i = 0; i < 10; i++) { batch.DrawString(ResourceManager.bauhaus, (i + 1) + ". " + names[i], new Vector2(5, 40 + 40 * i), Color.Orange); batch.DrawString(ResourceManager.bauhaus, scores[i] + "", new Vector2(ACWGame.WIDTH - 100 - scoreWidths[i], 40 + 40 * i), Color.Orange); } batch.DrawString(ResourceManager.bauhaus, "Press select to continue...", textPos, Color.Orange); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { this.FrameCount++; spriteBatch.Begin(); #if WINDOWS_PHONE long mem = Microsoft.Phone.Info.DeviceStatus.ApplicationCurrentMemoryUsage / 1024; spriteBatch.DrawString(Font, fps.ToString() + " Fps\n" + mem + " kb", Vector2.Zero, Color.White); #else spriteBatch.DrawString(Font, fps.ToString() + " Fps\n", Vector2.Zero, Color.White); #endif spriteBatch.End(); }
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 void Draw(Microsoft.Xna.Framework.Content.ContentManager content, Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { if (font == null) { //Load the font font = content.Load<SpriteFont>(@"Fonts/LightText"); } batch.Draw(content, SpriteManager.GetSprite(ColourSpriteName.WHITE), borderRect, Color.DarkGray); batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.PAPER_TEXTURE), rect, Color.White); batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.WOOD_TEXTURE), objectNameRect, Color.WhiteSmoke); batch.DrawString(font, treasureChest.Name, objectNameRect, Alignment.Center, Color.Black); batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.CLOSE), crossRect, Color.White); for (int i = 0; i < itemRectangles.Count; i++) { Rectangle r = itemRectangles[i]; MapItem mi = null; if (treasureChest.Contents.Count > i) { mi = treasureChest.Contents[i]; batch.Draw(content, mi.Graphics[0], r, Color.White); } } batch.DrawString(font, descriptionShown, descriptionRect, Alignment.Left, Color.Black); batch.Draw(content, SpriteManager.GetSprite(InterfaceSpriteName.WOOD_TEXTURE), takeAllRect, Color.White); batch.DrawString(font, "TAKE ALL", takeAllRect, Alignment.Center, Color.Black); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { if(varLink != null) { Vector2 vec = this.GetVector(); this.varLink.SetVector(ref vec); this.SetWidth(varLink.GetWidth()); this.SetHeight(varLink.GetHeight()); varLink.Draw(spriteBatch, primitiveDrawer, fontHandler, graphicsDevice); } else { primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, colorA); Vector2 ve = fontHandler.GetVerdana().MeasureString(this.typeOfVariable); this.width = (int)ve.X + 3; this.height = 30; Vector2 vec = this.GetVector(); vec.Y += 3; vec.X += 3; spriteBatch.DrawString(fontHandler.GetVerdana(), this.typeOfVariable, vec + TetrisGameRunner.GetOffsetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); } }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch pSpriteBatch) { pSpriteBatch.Begin(); pSpriteBatch.DrawString(m_pFont, "LOADING", new Microsoft.Xna.Framework.Vector2(100, 100), Color.White); pSpriteBatch.End(); base.Draw(pSpriteBatch); }
protected override void DrawAbovePlayers(Microsoft.Xna.Framework.Graphics.SpriteBatch sb) { sb.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, null, null, null, World.CamTransform); sb.DrawString(ArtAssets.WorldFont, "Blah", Vector2.Zero, Color.White, 0.0f, Vector2.Zero, WorldData.ZoomScaleAmount[World.CurrentZoom], SpriteEffects.None, 1.0f); sb.End(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch, GameTime gameTime) { base.Draw(batch, gameTime); if (player != null) batch.DrawString(ProjectData.smallFont, dialogue, new Vector2(pos.X - (Position.X / 2), pos.Y - ProjectData.smallFont.MeasureString(dialogue).Y - 2), Color.White); }
public static void DrawTextCentered(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Vector2 position, Color color, string text) { if (_spriteFont == null) _spriteFont = GameObject.Content.Load<SpriteFont>("Fotograaf/Fonts/defaultfont"); Vector2 boundingBox = _spriteFont.MeasureString(text); spriteBatch.DrawString(_spriteFont, text, new Vector2((float)Math.Ceiling(position.X - boundingBox.X / 2), position.Y), color); }
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 canvas, int x, int y, bool selected) { if (selected) { canvas.Draw(AssetLoader.diamond, new Rectangle(x - 50, y + 6, 40, 15), Color.White); } canvas.DrawString(AssetLoader.fnt_assetloadscreen, label, new Vector2(x, y), (selected)?Color.White:Color.Gray); }
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 override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { if (Text == null) Text = ""; Vector2 center = (TGame.Instance.MainFont.MeasureString(Text) * 0.5f); batch.DrawString(TGame.Instance.MainFont, Text, transform.Position, renderer.BlendColor, transform.Rotation, center, Scale, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0); }
public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { Color textCol = Color.White; batch.Begin(); Vector2 textPos = new Vector2(-Screen.X + 0.05f, Screen.Y - 0.55f); Vector2 awarePos = new Vector2(-Screen.X + 0.05f, Screen.Y - 0.65f); if (timer < scenes[level].Length) { batch.DrawString(font, " Press and release 'attack' to continue...", Screen.RelationToPosition(awarePos), textCol); batch.DrawString(font, scenes[level][timer] + "", Screen.RelationToPosition(textPos), textCol); } //Console.WriteLine("level:"+level); //Console.WriteLine("timer:"+timer); batch.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 spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { SetWidth((int)fontHandler.GetVerdana().MeasureString(this.eventName).X + 8); Vector2 adjust = GetVector(); adjust.X += 4; spriteBatch.DrawString(fontHandler.GetVerdana(), this.eventName, adjust + TetrisGameRunner.GetOffsetVector(), Color.White); primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, Color.Green); spriteBatch.End(); spriteBatch.Begin(); }
public void Draw(Microsoft.Xna.Framework.GameTime gametime, Microsoft.Xna.Framework.Graphics.SpriteBatch spritebatch, GraphicsDevice graphics) { string text = ""; for (int i = 0; i < credits.Count; i++) { text += credits[i] + "\n"; } spritebatch.Begin(); spritebatch.Draw(bgTex, bgrect, Color.White); spritebatch.DrawString(font, text, pos, Color.White); spritebatch.End(); }
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 void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb, Microsoft.Xna.Framework.Game game) { game.GraphicsDevice.Clear(Color.Black); //Drawing title string title = getTitleMessage(); IList<string> choices = getChoices(); int windowWidth = game.GraphicsDevice.Viewport.Width; int windowHeight = game.GraphicsDevice.Viewport.Height; Vector2 titleSize = titleFont.MeasureString(title); sb.DrawString(titleFont, title, new Vector2(windowWidth / 2 - titleSize.X / 2, windowHeight * (3 / 8f) - titleSize.Y / 2), Color.White); //Drawing the options Vector2 oneSize = choicesFont.MeasureString(choices[0]); Vector2 twoSize = choicesFont.MeasureString(choices[1]); float extraSpace = windowWidth - (oneSize.X + twoSize.X + 20); float oneStartX = extraSpace / 2; float twoStartX = windowWidth - (extraSpace / 2 + twoSize.X); Rectangle selectedArea = new Rectangle((int)(leftSelected ? oneStartX : twoStartX) - 2, (int)(windowHeight * (5 / 8f) - 2), (int)(leftSelected ? oneSize.X : twoSize.X) + 2, (int)oneSize.Y + 2); Rectangle selectedMidArea = new Rectangle((int)(leftSelected ? oneStartX : twoStartX), (int)(windowHeight * (5 / 8f)), (int)(leftSelected ? oneSize.X : twoSize.X) - 2, (int)oneSize.Y - 2); sb.Draw(selectedText, selectedArea, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0); sb.Draw(backgroundSelected, selectedMidArea, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0.5f); sb.DrawString(choicesFont, choices[0], new Vector2(oneStartX, windowHeight * (5 / 8f)), Color.White); sb.DrawString(choicesFont, choices[1], new Vector2(twoStartX, windowHeight * (5 / 8f)), Color.White); //Drawing the Details string detes = getDetailMessage(); Vector2 detailsSize = detailsFont.MeasureString(detes); sb.DrawString(detailsFont, detes, new Vector2(windowWidth / 2 - detailsSize.X / 2, windowHeight * (7 / 8f) - detailsSize.Y / 2), Color.White); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { batch.Draw(image, new Rectangle(x_position-5, y_position-5, 360, y_spacing*(menuitems.Count + 1)+10), Color.Gray); batch.Draw(image, new Rectangle(x_position, y_position, 350, y_spacing * (menuitems.Count + 1)), Color.Black); batch.DrawString(font, team.TeamName, new Vector2(x_position, y_position), team.Color); foreach (MenuItem x in menuitems) { int i = menuitems.IndexOf(x) + 1; x.Draw(batch, font, x_position + i * x_spacing, y_position + y_spacing * i); } }
internal void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { var step = Steps.Any() ? Steps.FirstOrDefault(s => s.Number == CurrentStep) : null; var stepTitleWidth = (int) (GameConfig.Config.WindowWidth*0.7); if (step != null) { var titleString = Fonts.WrapText(step.Text, stepTitleWidth, StepTitleFont); spriteBatch.DrawString(StepTitleFont, titleString, titlePos, Color.White); } if (configWindow.Visible) configWindow.Draw(spriteBatch); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, PrimitiveDrawer primitiveDrawer, FontHandler fontHandler, Microsoft.Xna.Framework.Graphics.GraphicsDevice graphicsDevice) { if (width == 0) { Vector2 measure = fontHandler.GetLucidaSansTypewriter().MeasureString(" New Class "); this.width = (int)measure.X; this.height = (int)measure.Y; } primitiveDrawer.DrawRoundedRectangle(graphicsDevice, this, Color.Orange); spriteBatch.DrawString(fontHandler.GetLucidaSansTypewriter(), " New Class ", TetrisGameRunner.GetOffsetVector() +this.GetVector(), Color.White); spriteBatch.End(); spriteBatch.Begin(); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch pSpriteBatch) { pSpriteBatch.Begin(); // if(m_pTexture != null) pSpriteBatch.Draw(m_pTexture, new Vector2(0, 0), Color.White); m_pParticleEngine.Draw(pSpriteBatch, false); m_pScrollerDisplay.Draw(pSpriteBatch); pSpriteBatch.DrawString(m_pFont, "Press", new Vector2(100, 100), Color.White); pSpriteBatch.Draw(Constants.BUTTON_START, new Vector2(140, 100), Color.White); pSpriteBatch.End(); base.Draw(pSpriteBatch); }
public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { if (win) { int tmp = 0; foreach (GameObject go in Game1.AllObjects) { if (go is Player) { tmp = (go as Player).Team; } } spriteBatch.DrawString(Game1.Sf, "Player " + tmp + " Won the game! Press Esc to return to the lobby", Vector2.Zero, Color.Red); } base.Draw(spriteBatch); }
internal override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch batch, Microsoft.Xna.Framework.GameTime gameTime) { Game1 game1 = (Game1)Game1.game; string startInstructions = null; if (GamePad.GetState(PlayerIndex.One).IsConnected) { startInstructions = string.Format("press A to start"); } else { startInstructions = string.Format("mash space bar to start"); } Vector2 size = game1.ft_hud24.MeasureString(startInstructions); batch.DrawString(game1.ft_hud24, startInstructions, new Vector2 { X = (640 - size.X) / 2, Y = 400 }, Color.White); }
public override void DrawWorld(Microsoft.Xna.Framework.Graphics.SpriteBatch batch) { Color textCol = Color.White; if (time > 3.5) { textCol = Color.Lerp(Color.White, Color.Transparent, (float)((time - 3.5) / 0.5)); } if (time < 0.5) { textCol = Color.Lerp(Color.Transparent, Color.White, (float)(time / 0.5)); } batch.Begin(); Vector2 textPos = new Vector2(-Screen.X, -Screen.Y); batch.DrawString(font, "New Upgrade Available! Pause Game to Upgrade.", Screen.RelationToPosition(textPos), textCol); batch.End(); }