Skip to main content

Box and Frame

box-and-frame

See the BoxAndFrameDemo.cs.

namespace Gridrand.RimGui.Manual
{
/// <summary>
/// Demo of <see cref="Gui.Box(Contracts.Rect, int)"/> and
/// <see cref="Gui.Frame(Contracts.Rect, int)"/>.
/// </summary>
class BoxAndFrameDemo : ManualBase, IManual
{
public BoxAndFrameDemo(ManualBaseResource p) : base(p)
{
}

public void Draw()
{
Gui.Heading("Box");
// Allocate a 100x100 rectangle.
var boxRect = Ctx.AllocateRect(100f, 100f);
Gui.Box(boxRect);


Gui.Heading("Box(scope)");
// Start a box scope.
using (Gui.BeginBox())
{
Gui.Text("a");
Gui.Text("b");
Gui.Text("c");
}

Gui.Heading("Frame");
var frameRect = Ctx.AllocateRect(100f, 100f);
Gui.Frame(frameRect);

Gui.Heading("Box(scope) and Frame");
using (Gui.BeginBox())
{
Gui.Text("a");
Gui.Text("b");
Gui.Text("c");
}
//If you want to draw a box with a frame, use Box + Frame.
Gui.Frame(Ctx.GetLastWidgetRect());

Gui.Heading("FrameBox(scope)");
using (Gui.BeginFrameBox())
{
Gui.Text("a");
Gui.Text("b");
Gui.Text("c");
}
}
}
}