public static void DrawBackedText(this SpriteBatch graphics, string text, BfbVector position, BFBContentManager content, float scale = 1f) { SpriteFont font = content.GetFont("default"); Texture2D texture = content.GetTexture("default"); (float width, float height) = font.MeasureString(text); width *= scale; height *= scale; //Background graphics.Draw( texture, new Rectangle((int)position.X - 2, (int)position.Y - 2, (int)width + 4, (int)height + 2), new Color(0, 0, 0, 0.5f)); graphics.DrawString( font, text, position.ToVector2(), Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 1); }
public BfbVector ViewPointToMapPoint(BfbVector point) { if (!_init) { return(null); } BfbVector translatedPoint = new BfbVector(point.ToVector2()); translatedPoint.X /= Camera.GetScale().X; translatedPoint.Y /= Camera.GetScale().Y; translatedPoint.X += Camera.Position.X - Camera.Origin.X; translatedPoint.Y += Camera.Position.Y - Camera.Origin.Y; return(translatedPoint); }