Re-organize all projects (#4166)

This commit is contained in:
DrSmugleaf
2021-06-09 22:19:39 +02:00
committed by GitHub
parent 9f50e4061b
commit ff1a2d97ea
1773 changed files with 5258 additions and 5508 deletions

View File

@@ -0,0 +1,46 @@
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
namespace Content.Client.HealthOverlay.UI
{
public class HealthOverlayBar : Control
{
public const byte HealthBarScale = 2;
private const int XPixelDiff = 20 * HealthBarScale;
public HealthOverlayBar()
{
IoCManager.InjectDependencies(this);
Shader = IoCManager.Resolve<IPrototypeManager>().Index<ShaderPrototype>("unshaded").Instance();
}
private ShaderInstance Shader { get; }
/// <summary>
/// From -1 (dead) to 0 (crit) and 1 (alive)
/// </summary>
public float Ratio { get; set; }
public Color Color { get; set; }
protected override void Draw(DrawingHandleScreen handle)
{
base.Draw(handle);
handle.UseShader(Shader);
var leftOffset = 2 * HealthBarScale;
var box = new UIBox2i(
leftOffset,
-2 + 2 * HealthBarScale,
leftOffset + (int) (XPixelDiff * Ratio * UIScale),
-2);
handle.DrawRect(box, Color);
}
}
}