Basic Usage
See the BasicUsage.cs.
/// <summary>
/// Basic usage.
///
/// For basic usage of RimGui, please refer to "RimGui" rather than "RimGui Extensions".
///
/// The following classes are especially important within the library:
/// <see cref="ExtensionsGui"/>
/// <see cref="ExtensionsContext"/>
/// <see cref="ExtensionsStyle"/>
///
/// Context and Style are accessible through the Gui class:
/// <see cref="ExtensionsGui.Context"/>
/// <see cref="ExtensionsGui.Style"/>
///
/// The <see cref="ExtensionsStyle"/> is a class for configuring the overall settings of the <see cref="ExtensionsGui"/> and individual widget settings.
/// </summary>
class BasicUsage : ManualBase, IManual
{
readonly ExtensionsGui exGui;
readonly ExtensionsStyle exStyle;
int intValue = 50;
Vector2 vector2;
public BasicUsage(ManualBaseResource p) : base(p)
{
/// The Gui for Extensions can be obtained using <see cref="Gui.GetOrCreateExtension{Extension}"/>.
exGui = p.Gui.GetOrCreateExtension<ExtensionsGui>();
/// To obtain the Style for Extensions, it can be accessed via <see cref="ExtensionsGui.Style"/>.
exStyle = exGui.Style;
}
public void Draw()
{
Gui.Text("See the comments in the code.");
/// Since it's implemented as an extension method of Gui, like <see cref="GuiUtil.DragInputNumeric{TNumeric}(Gui, ref TNumeric, int)"/>,
/// coding is possible without needing to be aware of whether it's an Extension.
Gui.DragInput(ref vector2);
/// At the time of .NET Standard 2.1, property extension is not possible for Style.
/// Therefore, access to it is required through <see cref="ExtensionsStyle"/>.
using (exStyle.Ranges.BeginInt(0, 100))
{
Gui.DragInputNumeric(ref intValue);
}
}
}