66 lines
1.3 KiB
C#
66 lines
1.3 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using Decal.Adapter.Support;
|
|
using Decal.Interop.Core;
|
|
using Decal.Interop.Render;
|
|
|
|
namespace Decal.Adapter.Wrappers;
|
|
|
|
[CLSCompliant(true)]
|
|
public class HudRenderScalable : HudRenderTarget
|
|
{
|
|
private IRenderScalable myScalable;
|
|
|
|
/// <summary>
|
|
/// Returns the Area scaling has caused the Hud to encompass
|
|
/// </summary>
|
|
public Rectangle ScaleRect => Util.toRectangle(myScalable.ScaleRect);
|
|
|
|
/// <summary>
|
|
/// Scale the width and height of the Hud by the specified value keeping the current position.
|
|
/// This will not return 'good' values when using ScaleTo
|
|
/// </summary>
|
|
public float ScaleFactor
|
|
{
|
|
get
|
|
{
|
|
return myScalable.ScaleFactor;
|
|
}
|
|
set
|
|
{
|
|
myScalable.ScaleFactor = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Specifies whether or not Scaling is occuring (setting to false disables scaling)
|
|
/// </summary>
|
|
public bool Scaling
|
|
{
|
|
get
|
|
{
|
|
return myScalable.Scaling;
|
|
}
|
|
set
|
|
{
|
|
myScalable.Scaling = value;
|
|
}
|
|
}
|
|
|
|
[CLSCompliant(false)]
|
|
protected HudRenderScalable(IRenderScalable newTarget)
|
|
: base(newTarget)
|
|
{
|
|
myScalable = newTarget;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Scales the Hud to fill the area specified
|
|
/// </summary>
|
|
/// <param name="rect">Area for the Hud to encompass</param>
|
|
public void ScaleTo(Rectangle rect)
|
|
{
|
|
tagRECT pArea = Util.toTagRECT(rect);
|
|
myScalable.ScaleTo(ref pArea);
|
|
}
|
|
}
|