Update to imgui 1.52 (no native binary updates).

internals
Eric Mellino 7 years ago
parent 268b897b45
commit 27e9bf5fc1
  1. 4
      src/ImGui.NET.SampleProgram/MemoryEditor.cs
  2. 2
      src/ImGui.NET.SampleProgram/SampleWindow.cs
  3. 10
      src/ImGui.NET/FocusedFlags.cs
  4. 16
      src/ImGui.NET/FontConfig.cs
  5. 15
      src/ImGui.NET/HoveredFlags.cs
  6. 61
      src/ImGui.NET/ImGui.cs
  7. 28
      src/ImGui.NET/ImGuiNative.cs
  8. 40
      src/ImGui.NET/NativeIO.cs
  9. 5
      src/ImGui.NET/TreeNodeFlags.cs

@ -162,7 +162,7 @@ namespace ImGuiNET
else
{
ImGui.Text(FixedHex(mem_data[addr], 2));
if (AllowEdits && ImGui.IsLastItemHovered() && ImGui.IsMouseClicked(0))
if (AllowEdits && ImGui.IsItemHovered(HoveredFlags.Default) && ImGui.IsMouseClicked(0))
{
DataEditingTakeFocus = true;
DataEditingAddr = addr;
@ -197,7 +197,7 @@ namespace ImGuiNET
ImGui.Separator();
ImGuiNative.igAlignFirstTextHeightToWidgets();
ImGuiNative.igAlignTextToFramePadding();
ImGui.PushItemWidth(50);
ImGuiNative.igPushAllowKeyboardFocus(false);
int rows_backup = Rows;

@ -203,7 +203,7 @@ namespace ImGuiNET
ImGui.GetStyle().WindowRounding = 0;
ImGui.SetNextWindowSize(new System.Numerics.Vector2(_nativeWindow.Width - 10, _nativeWindow.Height - 20), Condition.Always);
ImGui.SetNextWindowPosCenter(Condition.Always);
ImGui.SetNextWindowPos(ImGui.GetIO().DisplaySize, Condition.Always, new System.Numerics.Vector2(1f));
ImGui.BeginWindow("ImGUI.NET Sample Program", ref _mainWindowOpened, WindowFlags.NoResize | WindowFlags.NoTitleBar | WindowFlags.NoMove);
ImGui.BeginMainMenuBar();

@ -0,0 +1,10 @@
namespace ImGuiNET
{
// Flags for ImGui::IsWindowFocused()
public enum FocusedFlags
{
ChildWindows = 1 << 0, // IsWindowFocused(): Return true if any children of the window is focused
RootWindow = 1 << 1, // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)
RootAndChildWindows = RootWindow | ChildWindows
}
}

@ -19,7 +19,7 @@ namespace ImGuiNET
/// TTF data ownership taken by the container ImFontAtlas (will delete memory itself).
/// Set to true.
/// </summary>
public bool FontDataOwnedByAtlas;
public byte FontDataOwnedByAtlas;
/// <summary>
/// 0.
/// Index of font within TTF file
@ -43,7 +43,7 @@ namespace ImGuiNET
/// Align every character to pixel boundary (if enabled, set OversampleH/V to 1).
/// Set to false.
/// </summary>
public bool PixelSnapH;
public byte PixelSnapH;
/// <summary>
/// Extra spacing (in pixels) between glyphs.
/// Set to (0, 0).
@ -62,7 +62,17 @@ namespace ImGuiNET
/// Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs).
/// Set to false.
/// </summary>
public bool MergeMode;
public byte MergeMode;
/// <summary>
/// Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one.
/// Defaults to 0.
/// </summary>
public uint RasterizerFlags;
/// <summary>
/// Brighten (&gt;1.0f) or darken (&lt;1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.
/// Defaults to 1.0.
/// </summary>
public float RasterizerMultiply;
// [Internal]
/// <summary>

@ -0,0 +1,15 @@
namespace ImGuiNET
{
// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()
public enum HoveredFlags
{
Default = 0, // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.
ChildWindows = 1 << 0, // IsWindowHovered() only: Return true if any children of the window is hovered
RootWindow = 1 << 1, // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)
AllowWhenBlockedByPopup = 1 << 2, // Return true even if a popup window is normally blocking access to this item/window
AllowWhenBlockedByActiveItem = 1 << 4, // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.
AllowWhenOverlapped = 1 << 5, // Return true even if the position is overlapped by another window
RectOnly = AllowWhenBlockedByPopup | AllowWhenBlockedByActiveItem | AllowWhenOverlapped,
RootAndChildWindows = RootWindow | ChildWindows
}
}

@ -443,14 +443,9 @@ namespace ImGuiNET
ImGuiNative.igSetNextWindowFocus();
}
public static void SetNextWindowPos(Vector2 position, Condition condition)
public static void SetNextWindowPos(Vector2 position, Condition condition, Vector2 pivot)
{
ImGuiNative.igSetNextWindowPos(position, condition);
}
public static void SetNextWindowPosCenter(Condition condition)
{
ImGuiNative.igSetNextWindowPosCenter(condition);
ImGuiNative.igSetNextWindowPos(position, condition, pivot);
}
public static void AddInputCharacter(char keyChar)
@ -709,6 +704,11 @@ namespace ImGuiNET
return ImGuiNative.igIsKeyReleased(keyIndex);
}
public static int GetKeyPressedAmount(int keyIndex, float repeatDelay, float rate)
{
return ImGuiNative.igGetKeyPressedAmount(keyIndex, repeatDelay, rate);
}
public static bool IsMouseDown(int button)
{
return ImGuiNative.igIsMouseDown(button);
@ -729,19 +729,19 @@ namespace ImGuiNET
return ImGuiNative.igIsMouseReleased(button);
}
public static bool IsWindowRectHovered()
public static bool IsAnyWindowHovered()
{
return ImGuiNative.igIsWindowRectHovered();
return ImGuiNative.igIsAnyWindowHovered();
}
public static bool IsAnyWindowHovered()
public static bool IsWindowFocused(FocusedFlags flags)
{
return ImGuiNative.igIsAnyWindowHovered();
return ImGuiNative.igIsWindowFocused(flags);
}
public static bool IsWindowFocused()
public static bool IsWindowHovered(HoveredFlags flags)
{
return ImGuiNative.igIsWindowFocused();
return ImGuiNative.igIsWindowHovered(flags);
}
public static bool IsMouseHoveringRect(Vector2 minPosition, Vector2 maxPosition, bool clip)
@ -749,6 +749,16 @@ namespace ImGuiNET
return ImGuiNative.igIsMouseHoveringRect(minPosition, maxPosition, clip);
}
public static unsafe bool IsMousePosValid()
{
return ImGuiNative.igIsMousePosValid(null);
}
public static unsafe bool IsMousePosValid(Vector2 mousePos)
{
return ImGuiNative.igIsMousePosValid(&mousePos);
}
public static bool IsMouseDragging(int button, float lockThreshold)
{
return ImGuiNative.igIsMouseDragging(button, lockThreshold);
@ -811,6 +821,12 @@ namespace ImGuiNET
ImGuiNative.igSetCursorScreenPos(pos);
}
public static void AlignTextToFramePadding()
{
ImGuiNative.igAlignTextToFramePadding();
}
public static bool BeginChild(string id, bool border = false, WindowFlags flags = 0)
{
return BeginChild(id, new Vector2(0, 0), border, flags);
@ -884,6 +900,11 @@ namespace ImGuiNET
return ImGuiNative.igBeginMainMenuBar();
}
public static bool OpenPopupOnItemClick(string id, int mouseButton)
{
return ImGuiNative.igOpenPopupOnItemClick(id, mouseButton);
}
public static bool BeginPopup(string id)
{
return ImGuiNative.igBeginPopup(id);
@ -1048,14 +1069,9 @@ namespace ImGuiNET
ImGuiNative.igPopClipRect();
}
public static bool IsLastItemHovered()
{
return ImGuiNative.igIsItemHovered();
}
public static bool IsItemRectHovered()
public static bool IsItemHovered(HoveredFlags flags)
{
return ImGuiNative.igIsItemRectHovered();
return ImGuiNative.igIsItemHovered(flags);
}
public static bool IsLastItemActive()
@ -1129,6 +1145,11 @@ namespace ImGuiNET
return result;
}
public static bool IsWindowAppearing()
{
return ImGuiNative.igIsWindowAppearing();
}
public static void SetWindowFontScale(float scale)
{
ImGuiNative.igSetWindowFontScale(scale);

@ -73,6 +73,9 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern NativeDrawList* igGetWindowDrawList();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsWindowAppearing();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetWindowFontScale(float scale);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igGetWindowPos(out Vector2 @out);
@ -85,11 +88,8 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsWindowCollapsed();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetNextWindowPos(Vector2 pos, Condition cond);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetNextWindowPosCenter(Condition cond);
public static extern void igSetNextWindowPos(Vector2 pos, Condition cond, Vector2 pivot);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetNextWindowSize(Vector2 size, Condition cond);
public delegate void ImGuiSizeConstraintCallback(IntPtr data);
@ -228,7 +228,7 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igSetCursorScreenPos(Vector2 pos);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern void igAlignFirstTextHeightToWidgets();
public static extern void igAlignTextToFramePadding();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern float igGetTextLineHeight();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
@ -584,6 +584,9 @@ namespace ImGuiNET
public static extern void igOpenPopup(string str_id);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igOpenPopupOnItemClick(string str_id, int mouse_button);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igBeginPopup(string str_id);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
@ -630,10 +633,7 @@ namespace ImGuiNET
// Utilities
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsItemHovered();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsItemRectHovered();
public static extern bool igIsItemHovered(HoveredFlags flags);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsItemActive();
@ -660,10 +660,10 @@ namespace ImGuiNET
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsWindowHovered();
public static extern bool igIsWindowHovered(HoveredFlags flags);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsWindowFocused();
public static extern bool igIsWindowFocused(FocusedFlags flags);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsRootWindowFocused();
@ -719,6 +719,8 @@ namespace ImGuiNET
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsKeyReleased(int user_key_index);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
public static extern int igGetKeyPressedAmount(int key_index, float repeat_delay, float rate);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsMouseDown(int button);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
@ -732,10 +734,10 @@ namespace ImGuiNET
public static extern bool igIsMouseReleased(int button);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsWindowRectHovered();
public static extern bool igIsAnyWindowHovered();
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsAnyWindowHovered();
public static extern bool igIsMousePosValid(Vector2* mousePos);
[DllImport(cimguiLib, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igIsMouseHoveringRect(Vector2 pos_min, Vector2 pos_max, bool clip);

@ -118,6 +118,11 @@ namespace ImGuiNET
/// Default value: True on OSX; false otherwise.
/// </summary>
public byte OSXBehaviors;
/// <summary>
/// Enable blinking cursor, for users who consider it annoying.
/// Default value: true.
/// </summary>
public byte OptCursorBlink;
//------------------------------------------------------------------
// User Functions
@ -196,6 +201,9 @@ namespace ImGuiNET
/// Keyboard modifier pressed: Alt
/// </summary>
public byte KeyAlt;
/// <summary>
/// Keyboard modifier pressed: Cmd/Super/Windows
/// </summary>
public byte KeySuper;
/// <summary>
/// Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
@ -224,6 +232,10 @@ namespace ImGuiNET
/// </summary>
public byte WantTextInput;
/// <summary>
/// MousePos has been altered, back-end should reposition mouse on next frame. Set only when 'NavMovesMouse=true'.
/// </summary>
public byte WantMoveMouse;
/// <summary>
/// Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames.
/// </summary>
public float Framerate;
@ -258,10 +270,6 @@ namespace ImGuiNET
/// </summary>
public Vector2 MousePosPrev;
/// <summary>
/// Mouse button went from !Down to Down
/// </summary>
public fixed byte MouseClicked[5];
/// <summary>
/// Position at time of clicking
/// </summary>
public Vector2 MouseClickedPos0;
@ -286,6 +294,10 @@ namespace ImGuiNET
/// </summary>
public fixed float MouseClickedTime[5];
/// <summary>
/// Mouse button went from !Down to Down
/// </summary>
public fixed byte MouseClicked[5];
/// <summary>
/// Has mouse button been double-clicked?
/// </summary>
public fixed byte MouseDoubleClicked[5];
@ -307,6 +319,26 @@ namespace ImGuiNET
/// </summary>
public fixed float MouseDownDurationPrev[5];
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs0;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs1;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs2;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs3;
/// <summary>
/// Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point
/// </summary>
public Vector2 MouseDragMaxDistanceAbs4;
/// <summary>
/// Squared maximum distance of how much mouse has traveled from the click point
/// </summary>
public fixed float MouseDragMaxDistanceSqr[5];

@ -45,7 +45,10 @@ namespace ImGuiNET
/// Display a bullet instead of arrow
/// </summary>
Bullet = 1 << 9,
/// <summary>
/// Use FramePadding (even for an unframed text node) to vertically align text baseline
/// </summary>
FramePadding = 1 << 10,
CollapsingHeader = Framed | NoAutoOpenOnLog
};
}

Loading…
Cancel
Save