Files
sbox-public/engine/Sandbox.System/UI/RenderState.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

39 lines
979 B
C#

namespace Sandbox.UI;
/// <summary>
/// Describes panel's position and size for rendering operations.
/// </summary>
public readonly struct RenderState
{
/// <summary>
/// Position of the panel on the X axis. This can be a negative value!
/// </summary>
public float X { readonly get; init; }
/// <summary>
/// Position of the panel on the Y axis. This can be a negative value!
/// </summary>
public float Y { readonly get; init; }
/// <summary>
/// Width of the panel.
/// </summary>
public float Width { readonly get; init; }
/// <summary>
/// Height of the panel.
/// </summary>
public float Height { readonly get; init; }
/// <summary>
/// Render Opacity Overrides
/// </summary>
internal float RenderOpacity { readonly get; init; }
/// <summary>
/// Allows easy cast to a <see cref="Rect"/> for usage in rendering functions.
/// </summary>
public static implicit operator Rect( RenderState rs ) => new( rs.X, rs.Y, rs.Width, rs.Height );
}