Button
See the ButtonDemo.cs.
namespace Gridrand.RimGui.Manual
{
/// <summary>
/// <see cref="Gui.Button(int)"/>
/// <see cref="Gui.BeginButton(int)"/> demo.
/// </summary>
class ButtonDemo : ManualBase, IManual
{
public ButtonDemo(ManualBaseResource p) : base(p)
{
}
public void Draw()
{
// An empty button that draws nothing except for the button itself.
// Returns true when pressed.
if (Gui.Button())
Logger.Debug("Pressed");
if (Gui.Button("Button"))
Logger.Debug("Pressed");
// Set the padding of the Button within the scope.
using (Style.Button.Paddings.Begin(new(2, 2, 2, 2)))
{
if (Gui.NextWidthHeight(30f, 30f).SpriteButton(Assets.SampleSprite))
Logger.Debug("Pressed");
}
// Begin the button scope.
using (Gui.BeginButton())
{
Gui.Text("0");
Gui.Text("1");
Gui.Text("2");
}
}
}
}