Avoid redundantly setting viewport parameters in BeginFrame.
- Cache the old resolution, scroll and zoom in BeginFrame, and don't bother updating the viewport parameters again until they change. - Pass around scroll as an int2 to reduce the number of back-and-forth casts.
This commit is contained in:
@@ -66,7 +66,7 @@ namespace OpenRA.Mods.RA
|
||||
var text = messages.Random(Game.CosmeticRandom);
|
||||
var textSize = r.Fonts["Bold"].Measure(text);
|
||||
|
||||
r.BeginFrame(float2.Zero, 1f);
|
||||
r.BeginFrame(int2.Zero, 1f);
|
||||
WidgetUtils.FillRectWithSprite(stripeRect, stripe);
|
||||
r.RgbaSpriteRenderer.DrawSprite(logo, logoPos);
|
||||
r.Fonts["Bold"].DrawText(text, new float2(r.Resolution.Width - textSize.X - 20, r.Resolution.Height - textSize.Y - 20), Color.White);
|
||||
|
||||
Reference in New Issue
Block a user