Skip to main content

SlidePad

slide-pad

See the SlidePadDemo.cs.

using Gridrand.Contracts;
using Gridrand.RimGui.Manual;

namespace Gridrand.RimGui.Extensions.Manual
{
/// <summary>
/// Demonstrates the use of the SlidePad.
/// The SlidePad allows the user to interact with a 2D control to manipulate a Vector2 value.
/// </summary>
class SlidePadDemo : ManualBase, IManual
{
public SlidePadDemo(ManualBaseResource p) : base(p)
{
}

public void Draw()
{
var rect = Ctx.AllocateRect(height: 100).CreateCentered(100, 100);
// The SlidePad outputs a Vector2 value based on user input.
Gui.NextRect(rect).SlidePad(out Vector2 value);

using (Style.Text.AlignmentXs.Begin(AlignmentX.Center))
using (Style.FontSizes.Begin(30f))
Gui.NextRect(Ctx.AllocateRect(height: 50)).Text($"{value.x:F2} , {value.y:F2}");
}
}

}