Update to version 1.51 of cimgui/imgui.

internals
David Pethes 7 years ago
parent f75a26740e
commit 02bc394a19
  1. BIN
      deps/cimgui/win-x64/cimgui.dll
  2. 8
      src/ImGui.NET.SampleProgram/SampleWindow.cs
  3. 29
      src/ImGui.NET/ColorEditFlags.cs
  4. 14
      src/ImGui.NET/ColorEditMode.cs
  5. 6
      src/ImGui.NET/ColorTarget.cs
  6. 2
      src/ImGui.NET/Condition.cs
  7. 75
      src/ImGui.NET/ImGui.cs
  8. 58
      src/ImGui.NET/ImGuiNative.cs

Binary file not shown.

@ -202,8 +202,8 @@ namespace ImGuiNET
{
ImGui.GetStyle().WindowRounding = 0;
ImGui.SetNextWindowSize(new System.Numerics.Vector2(_nativeWindow.Width - 10, _nativeWindow.Height - 20), SetCondition.Always);
ImGui.SetNextWindowPosCenter(SetCondition.Always);
ImGui.SetNextWindowSize(new System.Numerics.Vector2(_nativeWindow.Width - 10, _nativeWindow.Height - 20), Condition.Always);
ImGui.SetNextWindowPosCenter(Condition.Always);
ImGui.BeginWindow("ImGUI.NET Sample Program", ref _mainWindowOpened, WindowFlags.NoResize | WindowFlags.NoTitleBar | WindowFlags.NoMove);
ImGui.BeginMainMenuBar();
@ -247,8 +247,8 @@ namespace ImGuiNET
}
if (ImGui.TreeNode("Second Item"))
{
ImGui.ColorButton(_buttonColor, false, true);
if (ImGui.Button("Push me to change color", new System.Numerics.Vector2(120, 30)))
ImGui.ColorButton("Color button", _buttonColor, ColorEditFlags.Default, new System.Numerics.Vector2(0, 0));
if (ImGui.Button("Push me to change color", new System.Numerics.Vector2(0, 30)))
{
_buttonColor = new System.Numerics.Vector4(_buttonColor.Y + .25f, _buttonColor.Z, _buttonColor.X, _buttonColor.W);
if (_buttonColor.X > 1.0f)

@ -0,0 +1,29 @@
namespace ImGuiNET
{
/// <summary>
/// Enumeration for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()
/// </summary>
public enum ColorEditFlags : int
{
Default = 0,
NoAlpha = 1 << 1,
NoPicker = 1 << 2,
NoOptions = 1 << 3,
NoSmallPreview = 1 << 4,
NoInputs = 1 << 5,
NoTooltip = 1 << 6,
NoLabel = 1 << 7,
NoSidePreview = 1 << 8,
AlphaBar = 1 << 9,
AlphaPreview = 1 << 10,
AlphaPreviewHalf = 1 << 11,
HDR = 1 << 12,
RGB = 1 << 13,
HSV = 1 << 14,
HEX = 1 << 15,
Uint8 = 1 << 16,
Float = 1 << 17,
PickerHueBar = 1 << 18,
PickerHueWheel = 1 << 19,
}
}

@ -1,14 +0,0 @@
namespace ImGuiNET
{
/// <summary>
/// Enumeration for ColorEditMode()
/// </summary>
public enum ColorEditMode
{
UserSelect = -2,
UserSelectShowButton = -1,
RGB = 0,
HSV = 1,
HEX = 2
}
}

@ -36,9 +36,9 @@
Header,
HeaderHovered,
HeaderActive,
Column,
ColumnHovered,
ColumnActive,
Separator,
SeparatorHovered,
SeparatorActive,
ResizeGrip,
ResizeGripHovered,
ResizeGripActive,

@ -4,7 +4,7 @@
/// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions.
/// All those functions treat 0 as a shortcut to Always.
/// </summary>
public enum SetCondition
public enum Condition
{
/// <summary>
/// Set the variable.

@ -181,15 +181,15 @@ namespace ImGuiNET
return ImGuiNative.igCombo(label, ref current_item, items, items.Length, heightInItems);
}
public static bool ColorButton(Vector4 color, bool smallHeight, bool outlineBorder)
public static bool ColorButton(string desc_id, Vector4 color, ColorEditFlags flags, Vector2 size)
{
return ImGuiNative.igColorButton(color, smallHeight, outlineBorder);
return ImGuiNative.igColorButton(desc_id, color, flags, size);
}
public static unsafe bool ColorEdit3(string label, ref float r, ref float g, ref float b, bool showAlpha)
public static unsafe bool ColorEdit3(string label, ref float r, ref float g, ref float b, ColorEditFlags flags = ColorEditFlags.Default)
{
Vector3 localColor = new Vector3(r, g, b);
bool result = ImGuiNative.igColorEdit3(label, &localColor);
bool result = ImGuiNative.igColorEdit3(label, &localColor, flags);
if (result)
{
r = localColor.X;
@ -200,10 +200,10 @@ namespace ImGuiNET
return result;
}
public static unsafe bool ColorEdit3(string label, ref Vector3 color, bool showAlpha)
public static unsafe bool ColorEdit3(string label, ref Vector3 color, ColorEditFlags flags = ColorEditFlags.Default)
{
Vector3 localColor = color;
bool result = ImGuiNative.igColorEdit3(label, &localColor);
bool result = ImGuiNative.igColorEdit3(label, &localColor, flags);
if (result)
{
color = localColor;
@ -212,10 +212,10 @@ namespace ImGuiNET
return result;
}
public static unsafe bool ColorEdit4(string label, ref float r, ref float g, ref float b, ref float a, bool showAlpha)
public static unsafe bool ColorEdit4(string label, ref float r, ref float g, ref float b, ref float a, ColorEditFlags flags = ColorEditFlags.Default)
{
Vector4 localColor = new Vector4(r, g, b, a);
bool result = ImGuiNative.igColorEdit4(label, &localColor, showAlpha);
bool result = ImGuiNative.igColorEdit4(label, &localColor, flags);
if (result)
{
r = localColor.X;
@ -227,10 +227,10 @@ namespace ImGuiNET
return result;
}
public static unsafe bool ColorEdit4(string label, ref Vector4 color, bool showAlpha)
public static unsafe bool ColorEdit4(string label, ref Vector4 color, ColorEditFlags flags = ColorEditFlags.Default)
{
Vector4 localColor = color;
bool result = ImGuiNative.igColorEdit4(label, &localColor, showAlpha);
bool result = ImGuiNative.igColorEdit4(label, &localColor, flags);
if (result)
{
color = localColor;
@ -239,9 +239,26 @@ namespace ImGuiNET
return result;
}
public static void ColorEditMode(ColorEditMode mode)
public static unsafe bool ColorPicker3(string label, ref Vector3 color, ColorEditFlags flags = ColorEditFlags.Default)
{
ImGuiNative.igColorEditMode(mode);
Vector3 localColor = color;
bool result = ImGuiNative.igColorPicker3(label, &localColor, flags);
if (result)
{
color = localColor;
}
return result;
}
public static unsafe bool ColorPicker4(string label, ref Vector4 color, ColorEditFlags flags = ColorEditFlags.Default)
{
Vector4 localColor = color;
bool result = ImGuiNative.igColorPicker4(label, &localColor, flags);
if (result)
{
color = localColor;
}
return result;
}
public unsafe static void PlotLines(
@ -416,7 +433,7 @@ namespace ImGuiNET
return ImGuiNative.igButton(message, size);
}
public static void SetNextWindowSize(Vector2 size, SetCondition condition)
public static void SetNextWindowSize(Vector2 size, Condition condition)
{
ImGuiNative.igSetNextWindowSize(size, condition);
}
@ -426,12 +443,12 @@ namespace ImGuiNET
ImGuiNative.igSetNextWindowFocus();
}
public static void SetNextWindowPos(Vector2 position, SetCondition condition)
public static void SetNextWindowPos(Vector2 position, Condition condition)
{
ImGuiNative.igSetNextWindowPos(position, condition);
}
public static void SetNextWindowPosCenter(SetCondition condition)
public static void SetNextWindowPosCenter(Condition condition)
{
ImGuiNative.igSetNextWindowPosCenter(condition);
}
@ -488,7 +505,7 @@ namespace ImGuiNET
}
public static void SetWindowSize(Vector2 size, SetCondition cond = 0)
public static void SetWindowSize(Vector2 size, Condition cond = 0)
{
ImGuiNative.igSetWindowSize(size, cond);
}
@ -712,14 +729,14 @@ namespace ImGuiNET
return ImGuiNative.igIsMouseReleased(button);
}
public static bool IsMouseHoveringWindow()
public static bool IsWindowRectHovered()
{
return ImGuiNative.igIsMouseHoveringWindow();
return ImGuiNative.igIsWindowRectHovered();
}
public static bool IsMouseHoveringAnyWindow()
public static bool IsAnyWindowHovered()
{
return ImGuiNative.igIsMouseHoveringAnyWindow();
return ImGuiNative.igIsAnyWindowHovered();
}
public static bool IsWindowFocused()
@ -956,6 +973,11 @@ namespace ImGuiNET
ImGuiNative.igEndPopup();
}
public static bool IsPopupOpen(string id)
{
return ImGuiNative.igIsPopupOpen(id);
}
public static unsafe void Dummy(Vector2 size)
{
ImGuiNative.igDummy(&size);
@ -996,6 +1018,11 @@ namespace ImGuiNET
return ImGuiNative.igGetColumnWidth(columnIndex);
}
public static void SetColumnWidth(int columnIndex, float width)
{
ImGuiNative.igSetColumnWidth(columnIndex, width);
}
public static int GetColumnsCount()
{
return ImGuiNative.igGetColumnsCount();
@ -1026,9 +1053,9 @@ namespace ImGuiNET
return ImGuiNative.igIsItemHovered();
}
public static bool IsLastItemHoveredRect()
public static bool IsItemRectHovered()
{
return ImGuiNative.igIsItemHoveredRect();
return ImGuiNative.igIsItemRectHovered();
}
public static bool IsLastItemActive()
@ -1058,10 +1085,10 @@ namespace ImGuiNET
public static void SetNextTreeNodeOpen(bool opened)
{
ImGuiNative.igSetNextTreeNodeOpen(opened, SetCondition.Always);
ImGuiNative.igSetNextTreeNodeOpen(opened, Condition.Always);
}
public static void SetNextTreeNodeOpen(bool opened, SetCondition setCondition)
public static void SetNextTreeNodeOpen(bool opened, Condition setCondition)
{
ImGuiNative.igSetNextTreeNodeOpen(opened, setCondition);
}

@ -87,11 +87,11 @@ namespace ImGuiNET
public static extern bool igIsWindowCollapsed();
[DllImport(cimguiLib)]
public static extern void igSetNextWindowPos(Vector2 pos, SetCondition cond);
public static extern void igSetNextWindowPos(Vector2 pos, Condition cond);
[DllImport(cimguiLib)]
public static extern void igSetNextWindowPosCenter(SetCondition cond);
public static extern void igSetNextWindowPosCenter(Condition cond);
[DllImport(cimguiLib)]
public static extern void igSetNextWindowSize(Vector2 size, SetCondition cond);
public static extern void igSetNextWindowSize(Vector2 size, Condition cond);
public delegate void ImGuiSizeConstraintCallback(IntPtr data);
[DllImport(cimguiLib)]
public static extern void igSetNextWindowSizeConstraints(Vector2 size_min, Vector2 size_max, ImGuiSizeConstraintCallback custom_callback, void* custom_callback_data);
@ -100,23 +100,23 @@ namespace ImGuiNET
[DllImport(cimguiLib)]
public static extern void igSetNextWindowContentWidth(float width);
[DllImport(cimguiLib)]
public static extern void igSetNextWindowCollapsed(bool collapsed, SetCondition cond);
public static extern void igSetNextWindowCollapsed(bool collapsed, Condition cond);
[DllImport(cimguiLib)]
public static extern void igSetNextWindowFocus();
[DllImport(cimguiLib)]
public static extern void igSetWindowPos(Vector2 pos, SetCondition cond); //(not recommended)
public static extern void igSetWindowPos(Vector2 pos, Condition cond); //(not recommended)
[DllImport(cimguiLib)]
public static extern void igSetWindowSize(Vector2 size, SetCondition cond); //(not recommended)
public static extern void igSetWindowSize(Vector2 size, Condition cond); //(not recommended)
[DllImport(cimguiLib)]
public static extern void igSetWindowCollapsed(bool collapsed, SetCondition cond); //(not recommended)
public static extern void igSetWindowCollapsed(bool collapsed, Condition cond); //(not recommended)
[DllImport(cimguiLib)]
public static extern void igSetWindowFocus(); //(not recommended)
[DllImport(cimguiLib)]
public static extern void igSetWindowPosByName(string name, Vector2 pos, SetCondition cond);
public static extern void igSetWindowPosByName(string name, Vector2 pos, Condition cond);
[DllImport(cimguiLib)]
public static extern void igSetWindowSize2(string name, Vector2 size, SetCondition cond);
public static extern void igSetWindowSize2(string name, Vector2 size, Condition cond);
[DllImport(cimguiLib)]
public static extern void igSetWindowCollapsed2(string name, bool collapsed, SetCondition cond);
public static extern void igSetWindowCollapsed2(string name, bool collapsed, Condition cond);
[DllImport(cimguiLib)]
public static extern void igSetWindowFocus2(string name);
@ -250,6 +250,8 @@ namespace ImGuiNET
[DllImport(cimguiLib)]
public static extern float igGetColumnWidth(int column_index);
[DllImport(cimguiLib)]
public static extern void igSetColumnWidth(int column_index, float width);
[DllImport(cimguiLib)]
public static extern int igGetColumnsCount();
@ -346,15 +348,22 @@ namespace ImGuiNET
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igColorButton(Vector4 col, bool small_height, bool outline_border);
public static extern bool igColorButton(string desc_id, Vector4 col, ColorEditFlags flags, Vector2 size);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igColorEdit3(string label, Vector3* col, ColorEditFlags flags = 0);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igColorEdit3(string label, Vector3* col);
public static extern bool igColorEdit4(string label, Vector4* col, ColorEditFlags flags = 0);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igColorEdit4(string label, Vector4* col, bool show_alpha);
public static extern bool igColorPicker3(string label, Vector3* col, ColorEditFlags flags = 0);
[DllImport(cimguiLib)]
public static extern void igColorEditMode(ColorEditMode mode);
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igColorPicker4(string label, Vector4* col, ColorEditFlags flags = 0, float* ref_col = null);
[DllImport(cimguiLib)]
public static extern void SetColorEditOptions(ColorEditFlags flags);
[DllImport(cimguiLib)]
public static extern void igPlotLines(string label, float* values, int values_count, int values_offset, string overlay_text, float scale_min, float scale_max, Vector2 graph_size, int stride);
public delegate float ImGuiPlotHistogramValuesGetter(IntPtr data, int idx);
@ -497,7 +506,7 @@ namespace ImGuiNET
[DllImport(cimguiLib)]
public static extern float igGetTreeNodeToLabelSpacing();
[DllImport(cimguiLib)]
public static extern void igSetNextTreeNodeOpen(bool opened, SetCondition cond);
public static extern void igSetNextTreeNodeOpen(bool opened, Condition cond);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igCollapsingHeader(string label, TreeNodeFlags flags = 0);
@ -538,10 +547,6 @@ namespace ImGuiNET
public static extern void igValueUInt(string prefix, uint v);
[DllImport(cimguiLib)]
public static extern void igValueFloat(string prefix, float v, string float_format);
[DllImport(cimguiLib)]
public static extern void igValueColor(string prefix, Vector4 v);
[DllImport(cimguiLib)]
public static extern void igValueColor2(string prefix, uint v);
// Tooltip
[DllImport(cimguiLib)]
@ -589,13 +594,15 @@ namespace ImGuiNET
public static extern bool igBeginPopupContextItem(string str_id, int mouse_button);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igBeginPopupContextWindow(bool also_over_items, string str_id, int mouse_button);
public static extern bool igBeginPopupContextWindow(string str_id, int mouse_button, bool also_over_items);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igBeginPopupContextVoid(string str_id, int mouse_button);
[DllImport(cimguiLib)]
public static extern void igEndPopup();
[DllImport(cimguiLib)]
public static extern bool igIsPopupOpen(string str_id);
[DllImport(cimguiLib)]
public static extern void igCloseCurrentPopup();
// Logging: all text output from interface is redirected to tty/file/clipboard. Tree nodes are automatically opened.
@ -626,7 +633,7 @@ namespace ImGuiNET
public static extern bool igIsItemHovered();
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsItemHoveredRect();
public static extern bool igIsItemRectHovered();
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsItemActive();
@ -673,14 +680,11 @@ namespace ImGuiNET
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsRectVisible2(Vector2* rect_min, Vector2* rect_max);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsPosHoveringAnyWindow(Vector2 pos);
[DllImport(cimguiLib)]
public static extern float igGetTime();
[DllImport(cimguiLib)]
public static extern int igGetFrameCount();
[DllImport(cimguiLib)]
public static extern string igGetStyleColName(ColorTarget idx);
public static extern string igGetStyleColorName(ColorTarget idx);
[DllImport(cimguiLib)]
public static extern void igCalcItemRectClosestPoint(out Vector2 pOut, Vector2 pos, bool on_edge, float outward);
[DllImport(cimguiLib)]
@ -728,10 +732,10 @@ namespace ImGuiNET
public static extern bool igIsMouseReleased(int button);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsMouseHoveringWindow();
public static extern bool igIsWindowRectHovered();
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsMouseHoveringAnyWindow();
public static extern bool igIsAnyWindowHovered();
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsMouseHoveringRect(Vector2 pos_min, Vector2 pos_max, bool clip);

Loading…
Cancel
Save