Class ImGui
Inheritance
Inherited Members
Namespace: InitialPrefabs.NimGui
Assembly: InitialPrefabs.ImGui.dll
Syntax
public static class ImGui
Methods
BeginCollapsible(ImWindow, in ImString, in ImButtonStyle, Boolean, out Boolean)
Creates a collapsible area.
Declaration
public static void BeginCollapsible(ImWindow window, in ImString label, in ImButtonStyle style, bool isInitiallyCollapsed, out bool isCollapsed)
Parameters
| Type | Name | Description |
|---|---|---|
| ImWindow | window | The window to create the collapsible area in. |
| ImString | label | The content to show in the clickable button. |
| ImButtonStyle | style | The style of the collapsible area. |
| System.Boolean | isInitiallyCollapsed | Should the area be collapsed on start? |
| System.Boolean | isCollapsed | Is the area currently collapsed? |
BeginPane(String, in float2, in float2, in ImButtonStyle, in ImPaneStyle, out Boolean, out Boolean, ImPaneFlags)
Begins a draggable pane that defines a scope that can be drawn into.
Declaration
public static bool BeginPane(string title, in float2 position, in float2 size, in ImButtonStyle buttonStyle, in ImPaneStyle paneStyle, out bool collapse, out bool isBackbuffered, ImPaneFlags flags = (ImPaneFlags)0)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | title | Label for the window |
| Unity.Mathematics.float2 | position | The position of where to initially draw |
| Unity.Mathematics.float2 | size | How big the window is |
| ImButtonStyle | buttonStyle | Buttons colors |
| ImPaneStyle | paneStyle | Window colors |
| System.Boolean | collapse | Is the window collapsed? |
| System.Boolean | isBackbuffered | Is the window queued to a different buffer? |
| ImPaneFlags | flags |
Returns
| Type | Description |
|---|---|
| System.Boolean |
BeginScope(ImRect)
Begins a new scope and ensures so that all widgets drawn are now relative to the scope.
Declaration
public static void BeginScope(ImRect rect)
Parameters
| Type | Name | Description |
|---|---|---|
| ImRect | rect | The size and position of the new scope. |
BeginScrollArea(ImWindow, String, Single, Single, in ImScrollAreaStyle)
Starts a scroll area given the viewport height and the max height. The scroll area is hardscissored to the region drawn.
Declaration
public static void BeginScrollArea(ImWindow window, string title, float viewportHeight, float maxHeight, in ImScrollAreaStyle scrollAreaStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| ImWindow | window | |
| System.String | title | The unique identifier of the scroll area. |
| System.Single | viewportHeight | The height in which we can view. Typically smaller than the maxHeight. |
| System.Single | maxHeight | The maximum height that the area can store. |
| ImScrollAreaStyle | scrollAreaStyle | The style of the scroll area. |
Box(float2, Color32, Boolean)
Draws a box.
Declaration
public static void Box(float2 size, Color32 color, bool updateScope = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Unity.Mathematics.float2 | size | How big is the box? |
| UnityEngine.Color32 | color | What color is the box? |
| System.Boolean | updateScope | If the scope is updated, the next widget will be drawn below the box. |
Button(String)
The default Button using a preconfigured Button Style. This registers a click when the Mouse is released.
Declaration
public static bool Button(string label)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | The text to display in the button. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Button(String, in ImButtonStyle)
Constructs a text button given a label and a button style.
Declaration
public static bool Button(string label, in ImButtonStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | The text to display in the button. |
| ImButtonStyle | style | The style of button. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Button(UInt32, String)
Constructs a Button given a control ID and label with the default ButtonStyle.
Declaration
public static bool Button(uint controlID, string label)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | controlID | A supplied unique ID. |
| System.String | label | The text to display |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Button(UInt32, String, ImButtonStyle)
Constructs a Button given a control ID and label
Declaration
public static bool Button(uint controlID, string label, ImButtonStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | controlID | A supplied unique ID. |
| System.String | label | The text to display |
| ImButtonStyle | style | A custom button style |
Returns
| Type | Description |
|---|---|
| System.Boolean |
CalculateRemainingLineSize(ImWindow, Int32, in float2)
Calcaultes the size of the line based on the scope's next widget position.
Declaration
public static float2 CalculateRemainingLineSize(ImWindow window, int fontSize, in float2 padding)
Parameters
| Type | Name | Description |
|---|---|---|
| ImWindow | window | The window to calculate the remaining size. |
| System.Int32 | fontSize | The size of the font. |
| Unity.Mathematics.float2 | padding | The amount of spacing between the current and next widget. |
Returns
| Type | Description |
|---|---|
| Unity.Mathematics.float2 | The size of the rect. |
Dropdown(String, String[])
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string label, string[] options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide more context |
| System.String[] | options | A set number of options |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
Dropdown(String, String[], in ImDropDownStyle)
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string label, string[] options, in ImDropDownStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide more context |
| System.String[] | options | A set number of options |
| ImDropDownStyle | style | A style for the dropdown menu |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
Dropdown(String, UInt16, String[])
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string label, ushort initialIndex, string[] options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide more context |
| System.UInt16 | initialIndex | The initial index of the Dropdown |
| System.String[] | options | A set number of options |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
Dropdown(String, UInt16, String[], in ImDropDownStyle)
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string label, ushort initialIndex, string[] options, in ImDropDownStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide more context |
| System.UInt16 | initialIndex | The initial index of the Dropdown |
| System.String[] | options | A set number of options |
| ImDropDownStyle | style | A style for the dropdown menu |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
Dropdown(String[])
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string[] options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | options | A set number of options |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
Dropdown(String[], in ImDropDownStyle)
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string[] options, in ImDropDownStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | options | A set number of options |
| ImDropDownStyle | style | A style for the dropdown menu |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
Dropdown(String[], UInt16)
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string[] options, ushort initialIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | options | A set number of options |
| System.UInt16 | initialIndex |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
Dropdown(String[], UInt16, in ImDropDownStyle)
Shows a menu dropdown where you can select a single option. Elements behind the dropdown menu will not be selected.
Declaration
public static ushort Dropdown(string[] options, ushort initialIndex, in ImDropDownStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | options | A set number of options |
| System.UInt16 | initialIndex | |
| ImDropDownStyle | style | A style for the dropdown menu |
Returns
| Type | Description |
|---|---|
| System.UInt16 | The index of the element selected |
EndPane(ImWindow, Boolean, Boolean)
Ends the Pane so the next widget can be correctly drawn.
Declaration
public static void EndPane(ImWindow window, bool pop, bool autoLayout = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ImWindow | window | |
| System.Boolean | pop | Popping ensures that the next widget drawn is not backbuffered |
| System.Boolean | autoLayout | If you need to update the layout, for free floating panes, you don't need to |
EndScope(Boolean)
Ends the previous scope and updates the layout engine.
Declaration
public static void EndScope(bool autoLayout = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | autoLayout |
EndScrollArea(Boolean)
Ends the scroll area and disables hardware scissoring.
Declaration
public static void EndScrollArea(bool updateLayout = true)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | updateLayout | Should the layout be updated? Typically, yes. |
Label(Int32)
Creates a label from an integer.
Declaration
public static void Label(int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | value | The integer to display. |
Label(Int32, in ImTextStyle)
Creates a label from an integer.
Declaration
public static void Label(int value, in ImTextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | value | The integer to display. |
| ImTextStyle | style | The style of the text. |
Label(Single)
Creates a label from a floating point value.
Declaration
public static void Label(float value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | value | The floating point to display. |
Label(Single, in ImTextStyle)
Creates a label from a floating point value with a custom style.
Declaration
public static void Label(float value, in ImTextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | value | The floating point to display. |
| ImTextStyle | style | The style of the text. |
Label(String)
Creates a label to display some text with the default style.
Declaration
public static void Label(string label)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | Text to display |
Label(String, in ImTextStyle)
Creates a label to display some text with the default style.
Declaration
public static void Label(string label, in ImTextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | Text to display |
| ImTextStyle | style | The style of the text. |
Label(String, in float2)
Creates a label to display text with a custom size, but using the default style.
Declaration
public static void Label(string label, in float2 size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | Text to display |
| Unity.Mathematics.float2 | size | The size of the label's area |
Label(String, in float2, in ImTextStyle)
Creates a label to display text with a custom style.
Declaration
public static void Label(string label, in float2 size, in ImTextStyle textStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | Text to display. |
| Unity.Mathematics.float2 | size | The size of the label's area. |
| ImTextStyle | textStyle | The style of the text. |
Label(StringBuilder)
Creates a label to display some text using a StringBuilder with the default style.
Declaration
public static void Label(StringBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Text.StringBuilder | builder | The StringBuilder containing the text. |
Label(StringBuilder, in ImTextStyle)
Creates a label using a StringBuilder to display some text with the default style.
Declaration
public static void Label(StringBuilder builder, in ImTextStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Text.StringBuilder | builder | The StringBuilder containing the label. |
| ImTextStyle | style | The style of the text. |
Label(StringBuilder, float2, in ImTextStyle)
Create a label to display text using a StringBuilder and a custom style.
Declaration
public static void Label(StringBuilder builder, float2 size, in ImTextStyle textStyle)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Text.StringBuilder | builder | The StringBuilder containing the label. |
| Unity.Mathematics.float2 | size | The size of the label's area. |
| ImTextStyle | textStyle | The style of the text. |
Line()
Draws a line using the default style.
Declaration
public static void Line()
Line(ImLineStyle)
Draws a line given a custom style.
Declaration
public static void Line(ImLineStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| ImLineStyle | style | The style of the line. |
ProgressBar(Int32, Int32)
Creates a ProgressBar and displays the ratio as a fraction with a numerator and denominator using the default style. The width and height is based off of the last known scope and the size of the text.
Declaration
public static void ProgressBar(int num, int den)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | num | Numerator of the fraction |
| System.Int32 | den | Denominator of the fraction |
ProgressBar(Int32, Int32, in ImProgressBarStyle)
Creates a ProgressBar and displays the ratio as a fraction with a numerator and denominator using a custom style. The width and height is based off of the last known scope and the size of the text.
Declaration
public static void ProgressBar(int num, int den, in ImProgressBarStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | num | Numerator of the fraction |
| System.Int32 | den | Denominator of the fraction |
| ImProgressBarStyle | style | A custom style |
ProgressBar(Int32, Int32, float2)
Creates a ProgressBar and displays the ratio as a fraction with a numerator and denominator using the default style.
Declaration
public static void ProgressBar(int num, int den, float2 size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | num | Numerator of the fraction |
| System.Int32 | den | Denominator of the fraction |
| Unity.Mathematics.float2 | size | A custom size to define how large the progress bar is. |
ProgressBar(Int32, Int32, float2, in ImProgressBarStyle)
Creates a ProgressBar and displays the ratio as a fraction with a numerator and denominator using a custom style.
Declaration
public static void ProgressBar(int num, int den, float2 size, in ImProgressBarStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | num | Numerator of the fraction |
| System.Int32 | den | Denominator of the fraction |
| Unity.Mathematics.float2 | size | A custom size to define how large the progress bar is. |
| ImProgressBarStyle | style | A custom style |
ProgressBar(Single)
Creates a ProgressBar given a size using default styling. The size is determined by the line height and the width is determine by the parent scope.
Declaration
public static void ProgressBar(float ratio)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | ratio | A value between 0 and 1 |
ProgressBar(Single, Single)
Creates a ProgressBar given a width using the default styling.
Declaration
public static void ProgressBar(float ratio, float width)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | ratio | A value between 0 and 1 |
| System.Single | width | Max width of the rectangle containing the progress bar |
ProgressBar(Single, Single, in ImProgressBarStyle)
Creates a ProgressBar given a width using custom styling.
Declaration
public static void ProgressBar(float ratio, float width, in ImProgressBarStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | ratio | A value between 0 and 1 |
| System.Single | width | Max width of the rectangle containing the progress bar |
| ImProgressBarStyle | style | Custom style |
ProgressBar(Single, float2)
Creates a ProgressBar given a size using the default styling.
Declaration
public static void ProgressBar(float ratio, float2 size)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | ratio | A value between 0 and 1 |
| Unity.Mathematics.float2 | size | Size along the x and y axis |
ProgressBar(Single, float2, in ImProgressBarStyle)
Creates a ProgressBar given a size using custom styling.
Declaration
public static void ProgressBar(float ratio, float2 size, in ImProgressBarStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | ratio | A value between 0 and 1 |
| Unity.Mathematics.float2 | size | Size along the x and y axis |
| ImProgressBarStyle | style | A custom style |
Prune(String, PruneFlag)
Removes any id that has been internally cached. This includes Collapsed
elements, Dropdowns, Pane offsets, Scroll offsets, and Toggled states.
string title = "Title";
using (ImPane = new ImPane(title, ...)) {
...
}
ImGui.Prune(title, PruneFlag.Prune);
Declaration
public static void Prune(string title, PruneFlag flags = PruneFlag.All)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | title | A unique title. |
| PruneFlag | flags | The internal state to clean up, by default we clean everything. |
Prune(String[], PruneFlag)
Removes any id that has been internally cached. This includes Collapsed
elements, Dropdowns, Pane offsets, Scroll offsets, and Toggled states.
string title = "Title";
using (ImPane = new ImPane(title, ...)) {
...
}
ImGui.Prune(title, PruneFlag.Prune);
Declaration
public static void Prune(string[] titles, PruneFlag flags = PruneFlag.All)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | titles | An array of unique labels. |
| PruneFlag | flags | The internal state to clean up, by default we clean everything. |
Prune(UInt32, PruneFlag)
Removes any id that has been internally cached. This includes Collapsed
elements, Dropdowns, Pane offsets, Scroll offsets, and Toggled states.
int controlID = 1;
using (ImPane pane = new ImPane(controlID, ...)) {
...
}
ImGui.Prune(controlID, PruneFlag.Pane);
Declaration
public static void Prune(uint id, PruneFlag flags = PruneFlag.All)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | id | The unique ID to remove. |
| PruneFlag | flags | The internal state to clean up, by default we clean everything. |
Prune(UInt32[], PruneFlag)
Removes any id that has been internally cached. This includes Collapsed
elements, Dropdowns, Pane offsets, Scroll offsets, and Toggled states.
string title = "Title";
using (ImPane = new ImPane(title, ...)) {
...
}
ImGui.Prune(title, PruneFlag.Prune);
Declaration
public static void Prune(uint[] ids, PruneFlag flags = PruneFlag.All)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32[] | ids | An array of ids. |
| PruneFlag | flags | The internal state to clean up, by default we clean everything. |
SameLine()
Ensures that the next widget is drawn on the same line instead of the next line.
------------ ------------
| Widget 1 | | Widget 2 |
------------ ------------
The second widget will be drawn on the same line after Widget 1.
Declaration
public static void SameLine()
SkipLine()
Instead of drawing the widget on the next line, the next line is skipped and the next widget is drawn on that succeeding line.
------------
| Widget 1 |
------------
ImGui.SkipLine() will create an empty line here
------------
| Widget 2 |
------------
Declaration
public static void SkipLine()
SkipLine(in ImSkipLineStyle)
Instead of drawing the widget on the next line, the next line is skipped and the next widget is drawn on that succeeding line.
------------
| Widget 1 |
------------
ImGui.SkipLine() will create an empty line here
------------
| Widget 2 |
------------
Declaration
public static void SkipLine(in ImSkipLineStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| ImSkipLineStyle | style | A custom style for the skipped line. |
Slider(Int32, Int32, in ImSliderStyle, Single)
Returns a value between two integers.
Declaration
public static int Slider(int min, int max, in ImSliderStyle style, float t = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | min | The minimum value, must be less than the min |
| System.Int32 | max | The maximum value, must be greater than the min |
| ImSliderStyle | style | A custom slider style. |
| System.Single | t | The initial value between 0 and 1 that describes the value between the min and max. |
Returns
| Type | Description |
|---|---|
| System.Int32 |
Slider(Int32, Int32, Single)
Returns a value between two integers. Uses the default style. ImSliderStyle
Declaration
public static int Slider(int min, int max, float t = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | min | The minimum value, must be less than the min |
| System.Int32 | max | The maximum value, must be greater than the min |
| System.Single | t | The initial value between 0 and 1 that describes the value between the min and max. |
Returns
| Type | Description |
|---|---|
| System.Int32 |
Slider(Single, Single, in ImSliderStyle, Single)
Returns a value between two floating points.
Declaration
public static float Slider(float min, float max, in ImSliderStyle style, float t = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | min | The minimum value, must be less than the min |
| System.Single | max | The maximum value, must be greater than the min |
| ImSliderStyle | style | A custom slider style. |
| System.Single | t | The initial value between 0 and 1 that describes the value between the min and max. |
Returns
| Type | Description |
|---|---|
| System.Single |
Slider(Single, Single, Single)
Returns a value between two floating points. Uses the default style. ImSliderStyle
Declaration
public static float Slider(float min, float max, float t = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Single | min | The minimum value, must be less than the min |
| System.Single | max | The maximum value, must be greater than the min |
| System.Single | t | The initial value between 0 and 1 that describes the value between the min and max. |
Returns
| Type | Description |
|---|---|
| System.Single |
Slider(String, Int32, Int32, in ImSliderStyle)
Returns a value between two integers.
Declaration
public static int Slider(string label, int min, int max, in ImSliderStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | |
| System.Int32 | min | The minimum value, must be less than the min. |
| System.Int32 | max | The maximum value, must be greater than the min. |
| ImSliderStyle | style | A custom slider style. |
Returns
| Type | Description |
|---|---|
| System.Int32 |
Slider(String, Int32, Int32, Single)
Returns a value between two integers.
Declaration
public static int Slider(string label, int min, int max, float t = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide more context |
| System.Int32 | min | The minimum value, must be less than the min |
| System.Int32 | max | The maximum value, must be greater than the min |
| System.Single | t | The initial value between 0 and 1 that describes the value between the min and max. |
Returns
| Type | Description |
|---|---|
| System.Int32 |
Slider(String, Single, Single, in ImSliderStyle, Single)
Returns a value between two floating points.
Declaration
public static float Slider(string label, float min, float max, in ImSliderStyle style, float t = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide more context of the slider. |
| System.Single | min | The minimum value, must be less than the min |
| System.Single | max | The maximum value, must be greater than the min |
| ImSliderStyle | style | A custom slider style |
| System.Single | t | The initial value between 0 and 1 that describes the value between the min and max. |
Returns
| Type | Description |
|---|---|
| System.Single |
Slider(String, Single, Single, Single)
Returns a value between two floating points.
Declaration
public static float Slider(string label, float min, float max, float t = 0F)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide more context |
| System.Single | min | The minimum value, must be less than the min |
| System.Single | max | The maximum value, must be greater than the min |
| System.Single | t | The initial value between 0 and 1 that describes the value between the min and max. |
Returns
| Type | Description |
|---|---|
| System.Single |
TextField(String, StringBuilder)
Fills a StringBuilder with inputs given from the keyboard.
Declaration
public static void TextField(string label, StringBuilder builder)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | The label to describe the textfield's purpose |
| System.Text.StringBuilder | builder | The StringBuilder which will be filled by the TextField. |
TextField(String, StringBuilder, in ImTextFieldStyle)
Fills a StringBuilder with inputs given from the keyboard.
Declaration
public static void TextField(string label, StringBuilder builder, in ImTextFieldStyle style)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | The label to describe the textfield's purpose |
| System.Text.StringBuilder | builder | The StringBuilder which will be filled by the TextField. |
| ImTextFieldStyle | style | The style of the TextField. |
Toggle(String, in ImButtonStyle, Boolean)
Returns the current state of the Toggle box. If the box is checked, then the state is true, otherwise returns false.
class UIBehaviour {
// Gets called once per frame.
void Update() {
ImGui.Toggle("Label");
}
~UIBehaviour() {
ImGui.PruneToggle(TextUtils.GetStringHash("Label"), PruneFlags.Toggle);
}
}
Declaration
public static bool Toggle(string label, in ImButtonStyle style, bool initial = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide context for the toggle box |
| ImButtonStyle | style | A custom style for the button. |
| System.Boolean | initial | The initial value of the Toggle. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if checked, false if not. |
Toggle(String, Boolean)
Returns the current state of the Toggle box. If the box is checked, then the state is true, otherwise returns false.
class UIBehaviour {
// Gets called once per frame.
void Update() {
ImGui.Toggle("Label");
}
~UIBehaviour() {
ImGui.PruneToggle(TextUtils.GetStringHash("Label"), PruneFlags.Toggle);
}
}
Declaration
public static bool Toggle(string label, bool initial = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | label | A label to provide context for the toggle box |
| System.Boolean | initial | The initial value of the Toggle. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if checked, false if not. |
Toggle(out UInt32, in ImButtonStyle, Boolean)
Returns the current state of the Toggle box. If the box is checked, then the state is true, otherwise returns false.
class UIBehaviour {
uint toggleID;
// Gets called once per frame.
void Update() {
if (ImGui.Toggle(out toggleID)) {
...
}
}
~UIBehaviour() {
// Internally this will remove the cached Toggle state from
// it's internal hashmap, when this Object is destroyed.
ImGui.PruneToggle(toggleID, PruneFlags.Toggle);
}
}
Declaration
public static bool Toggle(out uint controlID, in ImButtonStyle style, bool initial = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | controlID | The value of the ID that NimGui generated for this Toggle |
| ImButtonStyle | style | A custom style for the toggle box. |
| System.Boolean | initial | The initial state of the Toggle. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if checked, false if not. |
Toggle(out UInt32, Boolean)
Returns the current state of the Toggle box. If the box is checked, then the state is true, otherwise returns false.
class UIBehaviour {
uint toggleID;
// Gets called once per frame.
void Update() {
if (ImGui.Toggle(out toggleID)) {
...
}
}
~UIBehaviour() {
// Internally this will remove the cached Toggle state from
// it's internal hashmap, when this Object is destroyed.
ImGui.Prune(toggleID, PruneFlag.Toggle);
}
}
Declaration
public static bool Toggle(out uint controlID, bool initial = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt32 | controlID | The value of the ID that NimGui generated for this Toggle |
| System.Boolean | initial | The initial state of the Toggle. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if checked, false if not. |