Files
OldThink/Content.Client/_White/Overlays/GrainOverlay.cs
rhailrake 483ab4eb2c - add: new tiles and another ui tweaks (#11)
* - fix: audio crash

* - tweak: main menu

* connect gui

* some shaders here

* tiles
2024-01-31 15:08:17 +00:00

39 lines
1021 B
C#

using Robust.Client.Graphics;
using Robust.Shared.Enums;
using Robust.Shared.Prototypes;
namespace Content.Client._White.Overlays;
public sealed class GrainOverlay : Overlay
{
[Dependency] private readonly IPrototypeManager _prototype = default!;
private readonly ShaderInstance _shader;
public GrainOverlay()
{
IoCManager.InjectDependencies(this);
_shader = _prototype.Index<ShaderPrototype>("Grain").Instance().Duplicate();
}
public override OverlaySpace Space => OverlaySpace.WorldSpace;
public override bool RequestScreenTexture => true;
protected override void Draw(in OverlayDrawArgs args)
{
if (ScreenTexture is null)
return;
var worldHandle = args.WorldHandle;
_shader.SetParameter("SCREEN_TEXTURE", ScreenTexture);
_shader.SetParameter("strength", 40.0f);
worldHandle.UseShader(_shader);
worldHandle.DrawRect(args.WorldBounds, Color.White);
worldHandle.UseShader(null);
}
}