Character name scale based on zoom

This commit is contained in:
juanjp600
2016-09-30 15:45:09 -03:00
parent f6b82eb095
commit 4c7e8fe57d
3 changed files with 8 additions and 7 deletions

View File

@@ -64,9 +64,9 @@ namespace Barotrauma
aiController.Update(deltaTime);
}
public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch,Camera cam)
{
base.DrawFront(spriteBatch);
base.DrawFront(spriteBatch,cam);
if (GameMain.DebugDraw && !isDead) aiController.DebugDraw(spriteBatch);
}

View File

@@ -1303,7 +1303,7 @@ namespace Barotrauma
CharacterHUD.Draw(spriteBatch, this, cam);
}
public virtual void DrawFront(SpriteBatch spriteBatch)
public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam)
{
if (!Enabled) return;
@@ -1321,14 +1321,15 @@ namespace Barotrauma
if (info != null)
{
Vector2 namePos = new Vector2(pos.X, pos.Y - 120.0f) - GUI.Font.MeasureString(Info.Name) * 0.5f;
Vector2 namePos = new Vector2(pos.X, pos.Y - 80.0f - (5.0f/cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
Color nameColor = Color.White;
if (Character.Controlled != null && TeamID!=Character.Controlled.TeamID)
{
nameColor = Color.Red;
}
spriteBatch.DrawString(GUI.Font, Info.Name, namePos + new Vector2(1.0f, 1.0f), Color.Black, 0.0f,Vector2.Zero,Vector2.One,SpriteEffects.None,0.001f);
spriteBatch.DrawString(GUI.Font, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, Vector2.One, SpriteEffects.None, 0.0f);
spriteBatch.DrawString(GUI.Font, Info.Name, namePos + new Vector2(1.0f/cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f,Vector2.Zero, 1.0f / cam.Zoom,SpriteEffects.None,0.001f);
spriteBatch.DrawString(GUI.Font, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f/cam.Zoom, SpriteEffects.None, 0.0f);
if (GameMain.DebugDraw)
{

View File

@@ -359,7 +359,7 @@ namespace Barotrauma
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch);
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch,cam);
spriteBatch.End();