Fix parallax on resolutions greater than 1920x1080 (#564)

This commit is contained in:
Tad Hardesty
2020-01-26 05:02:12 -08:00
committed by Pieter-Jan Briers
parent 4315618782
commit a6f8ee317f

View File

@@ -3,6 +3,7 @@ using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Graphics.Overlays;
using Robust.Client.Graphics.Shaders;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
@@ -15,6 +16,7 @@ namespace Content.Client.Parallax
#pragma warning disable 649
[Dependency] private readonly IParallaxManager _parallaxManager;
[Dependency] private readonly IEyeManager _eyeManager;
[Dependency] private readonly IClyde _displayManager;
[Dependency] private readonly IPrototypeManager _prototypeManager;
#pragma warning restore 649
@@ -55,10 +57,12 @@ namespace Content.Client.Parallax
ox = MathHelper.Mod(ox, sizeX);
oy = MathHelper.Mod(oy, sizeY);
screenHandle.DrawTexture(_parallaxTexture, new Vector2(ox, oy));
screenHandle.DrawTexture(_parallaxTexture, new Vector2(ox - sizeX, oy));
screenHandle.DrawTexture(_parallaxTexture, new Vector2(ox, oy - sizeY));
screenHandle.DrawTexture(_parallaxTexture, new Vector2(ox - sizeX, oy - sizeY));
var (screenSizeX, screenSizeY) = _displayManager.ScreenSize;
for (var x = -sizeX; x < screenSizeX; x += sizeX) {
for (var y = -sizeY; y < screenSizeY; y += sizeY) {
screenHandle.DrawTexture(_parallaxTexture, new Vector2(ox + x, oy + y));
}
}
}
}
}