Skip to main content
Version: 1.0.0-preview.36

Velaptor.NativeInterop.ImGui.ImGuiInvoker

Velaptor

Velaptor.NativeInterop.ImGui

ImGuiInvoker Class

Invokes ImGuiNET.ImGui functions.

public sealed class ImGuiInvoker :
Velaptor.NativeInterop.ImGui.IImGuiInvoker

Inheritance System.Object → ImGuiInvoker

Implements IImGuiInvoker

Methods

ArrowButton(string, ImGuiDir)

Creates an arrow button.

public bool ArrowButton(string str_id, ImGuiNET.ImGuiDir dir);

Parameters

str_id System.String

The id of the button.

dir ImGuiNET.ImGuiDir

The direction of the text relative to the button.

Implements ArrowButton(string, ImGuiDir)

Returns

System.Boolean
True if the button has been clicked.

Begin(string, ImGuiWindowFlags)

Creates a new window.

public bool Begin(string name, ImGuiNET.ImGuiWindowFlags flags);

Parameters

name System.String

The name of the window which becomes the title.

flags ImGuiNET.ImGuiWindowFlags

Various window options.

Implements Begin(string, ImGuiWindowFlags)

Returns

System.Boolean
True if the window is currently open.

Remarks

Make sure to invoke the End() method after creating a window.

BeginCombo(string, string, ImGuiComboFlags)

Creates a combo box control.

public bool BeginCombo(string label, string preview_value, ImGuiNET.ImGuiComboFlags flags);

Parameters

label System.String

The label of the combo box.

preview_value System.String

The preview value of the selected item.

flags ImGuiNET.ImGuiComboFlags

The combobox options.

Implements BeginCombo(string, string, ImGuiComboFlags)

Returns

System.Boolean
True if an item was chosen.

Button(string)

Creates a button with the given label.

public void Button(string label);

Parameters

label System.String

The button label.

Implements Button(string)

CalcTextSize(string)

Calculates the size of the given text.

public System.Numerics.Vector2 CalcTextSize(string text);

Parameters

text System.String

The text to measure.

Implements CalcTextSize(string)

Returns

System.Numerics.Vector2
The size of the text described by the X representing the width and the Y representing the height.

Checkbox(string, bool)

Creates a checkbox with the given label.

public bool Checkbox(string label, ref bool v);

Parameters

label System.String

The checkbox label.

v System.Boolean

The state of the checkbox.

Implements Checkbox(string, bool)

Returns

System.Boolean
True if the checkbox state was changed.

End()

Signifies the end of the creation of a window.

public void End();

Implements End()

EndCombo()

Signifies the end of the creation of a combo box.

public void EndCombo();

Implements EndCombo()

Remarks

This method should be called after BeginCombo(string, string, ImGuiComboFlags) if and only if BeginCombo(string, string, ImGuiComboFlags) returns true.

GetCursorPos()

Gets the current position of the cursor.

public System.Numerics.Vector2 GetCursorPos();

Implements GetCursorPos()

Returns

System.Numerics.Vector2
The cursor position.

GetFrameHeightWithSpacing()

Gets the current frame height with spacing.

public float GetFrameHeightWithSpacing();

Implements GetFrameHeightWithSpacing()

Returns

System.Single
The frame height.

GetIO()

Gets the IO object for system and ImGuiNET.ImGui related settings and information.

public ImGuiNET.ImGuiIOPtr GetIO();

Implements GetIO()

Returns

ImGuiNET.ImGuiIOPtr
The config/settings/info object.

GetStyle()

Gets the style object for ImGui.

public ImGuiNET.ImGuiStylePtr GetStyle();

Implements GetStyle()

Returns

ImGuiNET.ImGuiStylePtr
The style object.

GetWindowPos()

Gets the position of a window.

public System.Numerics.Vector2 GetWindowPos();

Implements GetWindowPos()

Returns

System.Numerics.Vector2
The window position.

GetWindowSize()

Gets the size of a window.

public System.Numerics.Vector2 GetWindowSize();

Implements GetWindowSize()

Returns

System.Numerics.Vector2
The size.

Remarks

The size of the text described by the X representing the width and the Y representing the height.

IsItemHovered()

Returns a value indicating whether the mouse is hovering over an item.

public bool IsItemHovered();

Implements IsItemHovered()

Returns

System.Boolean
True if the mouse is hovering over the item.

IsMouseDown(ImGuiMouseButton)

Returns a value indicating whether the given mouse button is in the down state.

public bool IsMouseDown(ImGuiNET.ImGuiMouseButton button);

Parameters

button ImGuiNET.ImGuiMouseButton

The button to check.

Implements IsMouseDown(ImGuiMouseButton)

Returns

System.Boolean
True if the mouse is in the down state.

IsMouseDragging(ImGuiMouseButton)

Gets a value indicating whether a window is being dragged by the given mouse button.

public bool IsMouseDragging(ImGuiNET.ImGuiMouseButton button);

Parameters

button ImGuiNET.ImGuiMouseButton

The mouse button.

Implements IsMouseDragging(ImGuiMouseButton)

Returns

System.Boolean
True if the window is being dragged.

IsMouseReleased(ImGuiMouseButton)

Returns a value indicating whether the given mouse button is in the released state.

public bool IsMouseReleased(ImGuiNET.ImGuiMouseButton button);

Parameters

button ImGuiNET.ImGuiMouseButton

The button to check.

Implements IsMouseReleased(ImGuiMouseButton)

Returns

System.Boolean
True if the mouse is in the up state.

IsWindowFocused()

Gets a value indicating whether a window is focused.

public bool IsWindowFocused();

Implements IsWindowFocused()

Returns

System.Boolean
True if the window is in focus.

PopButtonRepeat()

Stops the button from firing repeatedly when held down.

public void PopButtonRepeat();

Implements PopButtonRepeat()

PopID()

Ends the current scoped ID.

public void PopID();

Implements PopID()

PopStyleColor()

Pops the most recent style color.

public void PopStyleColor();

Implements PopStyleColor()

PopStyleColor(int)

Pops the most recent style colors a total number of times by the given count.

public void PopStyleColor(int count);

Parameters

count System.Int32

The total number of recent style color pushes to pop.

Implements PopStyleColor(int)

PopStyleVar(int)

Restores previous updated styles back to their original values.

public void PopStyleVar(int count);

Parameters

count System.Int32

The number of previous applied styles to restore.

Implements PopStyleVar(int)

PushButtonRepeat(bool)

Sets up a button to fire repeatedly when held down.

public void PushButtonRepeat(bool repeat);

Parameters

repeat System.Boolean

True to set the button to repeat.

Implements PushButtonRepeat(bool)

PushID(string)

Creates a new scoped ID for further control operations.

public void PushID(string str_id);

Parameters

str_id System.String

The id of the scope.

Implements PushID(string)

PushStyleColor(ImGuiCol, Vector4)

Pushes the color using the given col to the current style described by the given idx.

public void PushStyleColor(ImGuiNET.ImGuiCol idx, System.Numerics.Vector4 col);

Parameters

idx ImGuiNET.ImGuiCol

The type of area of the style to push the color.

col System.Numerics.Vector4

The color to push.

Implements PushStyleColor(ImGuiCol, Vector4)

PushStyleVar(ImGuiStyleVar, float)

Temporarily modifies the style of ImGuiNET.ImGui by applying a style to a part of
the GUI dictated by the given idx with the given val.

public void PushStyleVar(ImGuiNET.ImGuiStyleVar idx, float val);

Parameters

idx ImGuiNET.ImGuiStyleVar

The style to update.

val System.Single

The value to apply.

Implements PushStyleVar(ImGuiStyleVar, float)

Remarks

Remains in effect until the PopStyleVar(int) is invoked.

SameLine()

Sets the next control to be on the same line as the previous control.

public void SameLine();

Implements SameLine()

SameLine(float, float)

Sets the next control to be on the same line as the previous control.

public void SameLine(float offset_from_start_x, float spacing);

Parameters

offset_from_start_x System.Single

The horizontal offset from the start of the previous control.

spacing System.Single

The amount of spacing between the controls.

Implements SameLine(float, float)

Selectable(string, bool)

Returns a value indicating whether the given item label is selectable.

public bool Selectable(string label, bool selected);

Parameters

label System.String

The text to be displayed for the item in the combo box.

selected System.Boolean

Determines whether the item is selected when the combo box is first displayed.

Implements Selectable(string, bool)

Returns

System.Boolean
True if the item is selected.

SetCursorPos(Vector2)

Sets the position of the cursor.

public void SetCursorPos(System.Numerics.Vector2 local_pos);

Parameters

local_pos System.Numerics.Vector2

The position of where to set the cursor.

Implements SetCursorPos(Vector2)

SetItemDefaultFocus()

Sets the default keyboard focus to the item that was previously added.

public void SetItemDefaultFocus();

Implements SetItemDefaultFocus()

Remarks

This method is typically used in conjunction with combo boxes or list boxes.

SetNextItemWidth(float)

Sets the width of the next item.

public void SetNextItemWidth(float item_width);

Parameters

item_width System.Single

The width.

Implements SetNextItemWidth(float)

SetWindowPos(Vector2)

Sets the position of the window.

public void SetWindowPos(System.Numerics.Vector2 pos);

Parameters

pos System.Numerics.Vector2

The position.

Implements SetWindowPos(Vector2)

SetWindowSize(Vector2)

Sets the size of the window.

public void SetWindowSize(System.Numerics.Vector2 size);

Parameters

size System.Numerics.Vector2

The window size.

Implements SetWindowSize(Vector2)

Remarks

The size of the text described by the X representing the width and the Y representing the height.

SliderFloat(string, float, float, float)

Creates a slider scope with a float value.

public bool SliderFloat(string label, ref float v, float v_min, float v_max);

Parameters

label System.String

The label of the control.

v System.Single

The value of the control.

v_min System.Single

The minimum value.

v_max System.Single

The maximum value.

Implements SliderFloat(string, float, float, float)

Returns

System.Boolean
True if the button has been clicked.

Text(string)

Creates a test control.

public void Text(string fmt);

Parameters

fmt System.String

The text to display.

Implements Text(string)

Remarks

The fmt can take syntax for formatting values such as:

  • Numerical Formatting
    You can control how numeric values are displayed, including the number of decimal places,
    whether to use scientific notation, whether to include a thousands separator, and more.
    For example, {0:F2} formats the number with two decimal places.
  • Date and Time Formatting
    You can control how DateTime values are displayed, including the date format, time format, and more.
    For example, {0:yyyy-MM-dd} formats the date as year-month-day.
  • String Padding
    You can control the width of the field in which the string is printed, and whether it’s aligned to
    the left or right. For example, {0,10} prints the string in a field of width 10, right-aligned,
    while {0,-10} prints it left-aligned.
  • Custom Formatting
    You can define your own format strings to control how certain types of objects are displayed.
    can escape a brace by adding another brace.
    ple: {{ and }} will display as { and }.