Rework multi-resolution sprite handling:

- Sprite.Bounds now refers to rectangles in the source image.
  Use this when copying pixels, etc.
- Sprite.Size now refers to sizes in effective pixel coordinates.
  Use this when rendering.
- Sheet.DPIScale has been removed.
- "Density" term is introduced to refer to the number of artwork
  pixels per effective pixel.
This commit is contained in:
Paul Chote
2020-02-11 21:29:15 +00:00
committed by abcdefg30
parent c0ece00c4b
commit de4a7cecf0
15 changed files with 106 additions and 91 deletions

View File

@@ -24,6 +24,7 @@ namespace OpenRA.Mods.Common.LoadScreens
Sprite stripe, logo;
Sheet lastSheet;
int lastDensity;
Size lastResolution;
string[] messages = { "Loading..." };
@@ -36,13 +37,14 @@ namespace OpenRA.Mods.Common.LoadScreens
messages = info["Text"].Split(',');
}
public override void DisplayInner(Renderer r, Sheet s)
public override void DisplayInner(Renderer r, Sheet s, int density)
{
if (s != lastSheet)
if (s != lastSheet || density != lastDensity)
{
lastSheet = s;
logo = new Sprite(s, new Rectangle(0, 0, 256, 256), TextureChannel.RGBA);
stripe = new Sprite(s, new Rectangle(258, 0, 253, 256), TextureChannel.RGBA);
lastDensity = density;
logo = CreateSprite(s, density, new Rectangle(0, 0, 256, 256));
stripe = CreateSprite(s, density, new Rectangle(258, 0, 253, 256));
}
if (r.Resolution != lastResolution)