92 lines
1.3 KiB
C#
92 lines
1.3 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using Decal.Interop.Render;
|
|
|
|
namespace Decal.Adapter.Wrappers;
|
|
|
|
[CLSCompliant(true)]
|
|
public class Hud : HudRenderScalable
|
|
{
|
|
private HUDView internalView;
|
|
|
|
internal HUDView Underlying => internalView;
|
|
|
|
public bool Enabled
|
|
{
|
|
get
|
|
{
|
|
return internalView.Enabled;
|
|
}
|
|
set
|
|
{
|
|
internalView.Enabled = value;
|
|
}
|
|
}
|
|
|
|
public int Id => internalView.ID;
|
|
|
|
/// <summary>
|
|
/// Angle in Radians for rotation of the HUD
|
|
/// </summary>
|
|
public float Angle
|
|
{
|
|
get
|
|
{
|
|
return internalView.Angle;
|
|
}
|
|
set
|
|
{
|
|
internalView.Angle = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Alpha for entire hud
|
|
/// </summary>
|
|
public int Alpha
|
|
{
|
|
get
|
|
{
|
|
return internalView.Alpha;
|
|
}
|
|
set
|
|
{
|
|
internalView.Alpha = value;
|
|
}
|
|
}
|
|
|
|
internal event EventHandler Disposing;
|
|
|
|
internal Hud(HUDView view)
|
|
: base(view)
|
|
{
|
|
internalView = view;
|
|
}
|
|
|
|
public void SetBackground(Background background)
|
|
{
|
|
if (background != null)
|
|
{
|
|
internalView.SetBackground(background.Underlying);
|
|
return;
|
|
}
|
|
throw new ArgumentNullException("background");
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
try
|
|
{
|
|
if (disposing && this.Disposing != null)
|
|
{
|
|
this.Disposing(this, new EventArgs());
|
|
}
|
|
Marshal.ReleaseComObject(internalView);
|
|
internalView = null;
|
|
}
|
|
finally
|
|
{
|
|
base.Dispose(disposing);
|
|
}
|
|
}
|
|
}
|