Support custom zoom levels

This commit is contained in:
Paul Chote
2011-06-03 20:23:21 +12:00
parent 926b396605
commit fc783ddf80
12 changed files with 55 additions and 55 deletions

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA.Effects
string s;
int remaining;
int velocity;
float2 pos;
float2 pos, offset;
Color color;
public CashTick(int value, int lifetime, int velocity, float2 pos, Color color)
@@ -28,7 +28,8 @@ namespace OpenRA.Mods.RA.Effects
this.color = color;
this.velocity = velocity;
s = "{0}${1}".F(value < 0 ? "-" : "+", value);
this.pos = pos - 0.5f*Game.Renderer.Fonts["TinyBold"].Measure(s).ToFloat2();
this.pos = pos;
offset = 0.5f*Game.Renderer.Fonts["TinyBold"].Measure(s).ToFloat2();
remaining = lifetime;
}
@@ -41,7 +42,7 @@ namespace OpenRA.Mods.RA.Effects
public IEnumerable<Renderable> Render()
{
Game.Renderer.Fonts["TinyBold"].DrawTextWithContrast(s, pos - Game.viewport.Location, color, Color.Black,1);
Game.Renderer.Fonts["TinyBold"].DrawTextWithContrast(s, Game.viewport.Zoom*(pos - Game.viewport.Location) - offset, color, Color.Black,1);
yield break;
}
}