Merge pull request #6 from dpethes/update_imgui_149

Update to imgui 1.49
internals
Eric Mellino 8 years ago committed by GitHub
commit 24ed1a6478
  1. BIN
      deps/cimgui/win7-x64/cimgui.dll
  2. 64
      src/ImGui.NET/Font.cs
  3. 1
      src/ImGui.NET/ImGui.NET.Net46.csproj
  4. 1
      src/ImGui.NET/ImGui.NET.csproj
  5. 9
      src/ImGui.NET/ImGui.cs
  6. 82
      src/ImGui.NET/ImGuiNative.cs
  7. 7
      src/ImGui.NET/NativeIO.cs
  8. 4
      src/ImGui.NET/NativeStyle.cs
  9. 9
      src/ImGui.NET/Style.cs
  10. 2
      src/ImGui.NET/TextEditCallbackData.cs
  11. 51
      src/ImGui.NET/TreeNodeFlags.cs

Binary file not shown.

@ -21,8 +21,16 @@ namespace ImGuiNET
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct NativeFont public unsafe struct NativeFont
{ {
// Members: Settings [StructLayout(LayoutKind.Sequential)]
public struct Glyph
{
public ushort Codepoint;
public float XAdvance;
public float X0, Y0, X1, Y1;
public float U0, V0, U1, V1; // Texture coordinates
};
// Members: Hot ~62/78 bytes
/// <summary> /// <summary>
/// Height of characters, set during loading (don't change after loading). /// Height of characters, set during loading (don't change after loading).
/// Default value: [user-set] /// Default value: [user-set]
@ -39,55 +47,49 @@ namespace ImGuiNET
/// </summary> /// </summary>
public Vector2 DisplayOffset; public Vector2 DisplayOffset;
/// <summary> /// <summary>
/// Replacement glyph if one isn't found. Only set via SetFallbackChar() /// ImVector(Glyph)
/// Default value: '?'
/// </summary> /// </summary>
public ushort FallbackChar; public ImVector Glyphs;
/// <summary> /// <summary>
/// ImFontConfig*. Pointer within ImFontAtlas->ConfigData /// Sparse. Glyphs->XAdvance directly indexable (more cache-friendly that reading from Glyphs,
/// for CalcTextSize functions which are often bottleneck in large UI).
/// </summary> /// </summary>
public IntPtr ConfigData; public ImVector IndexXAdvance;
public int ConfigDataCount;
// Members: Runtime data
[StructLayout(LayoutKind.Sequential)]
public struct Glyph
{
public ushort Codepoint;
public float XAdvance;
public float X0, Y0, X1, Y1;
public float U0, V0, U1, V1; // Texture coordinates
};
/// <summary> /// <summary>
/// Ascent: distance from top to bottom of e.g. 'A' [0..FontSize] /// Sparse. Index glyphs by Unicode code-point.
/// </summary> /// </summary>
public float Ascent, Descent; public ImVector IndexLookup;
/// <summary> /// <summary>
/// ImFontAtlas* /// Equivalent to FindGlyph(FontFallbackChar)
/// </summary> /// </summary>
public IntPtr ContainerAtlas; // What we has been loaded into public Glyph* FallbackGlyph;
public float FallbackXAdvance;
/// <summary> /// <summary>
/// ImVector(Glyph) /// Replacement glyph if one isn't found. Only set via SetFallbackChar()
/// Default value: '?'
/// </summary> /// </summary>
public ImVector Glyphs; public ushort FallbackChar;
// Members: Cold ~18/26 bytes
public int ConfigDataCount;
/// <summary> /// <summary>
/// Equivalent to FindGlyph(FontFallbackChar) /// ImFontConfig*. Pointer within ImFontAtlas->ConfigData
/// </summary> /// </summary>
public Glyph* FallbackGlyph; public IntPtr ConfigData;
public float FallbackXAdvance;
/// <summary> /// <summary>
/// Sparse. Glyphs->XAdvance directly indexable (more cache-friendly that reading from Glyphs, /// ImFontAtlas*
/// for CalcTextSize functions which are often bottleneck in large UI).
/// </summary> /// </summary>
public ImVector IndexXAdvance; public IntPtr ContainerAtlas; // What we has been loaded into
/// <summary> /// <summary>
/// Sparse. Index glyphs by Unicode code-point. /// Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]
/// </summary> /// </summary>
public ImVector IndexLookup; public float Ascent, Descent;
}; };
} }

@ -15,6 +15,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Align.cs" /> <Compile Include="Align.cs" />
<Compile Include="ColorTarget.cs" /> <Compile Include="ColorTarget.cs" />
<Compile Include="TreeNodeFlags.cs" />
<Compile Include="IntStructs.cs" /> <Compile Include="IntStructs.cs" />
<Compile Include="MouseCursorKind.cs" /> <Compile Include="MouseCursorKind.cs" />
<Compile Include="NativeIO.cs" /> <Compile Include="NativeIO.cs" />

@ -13,6 +13,7 @@
<ItemGroup> <ItemGroup>
<Compile Include="Align.cs" /> <Compile Include="Align.cs" />
<Compile Include="ColorTarget.cs" /> <Compile Include="ColorTarget.cs" />
<Compile Include="TreeNodeFlags.cs" />
<Compile Include="IntStructs.cs" /> <Compile Include="IntStructs.cs" />
<Compile Include="MouseCursorKind.cs" /> <Compile Include="MouseCursorKind.cs" />
<Compile Include="NativeIO.cs" /> <Compile Include="NativeIO.cs" />

@ -140,9 +140,16 @@ namespace ImGuiNET
return ImGuiNative.igImageButton(userTextureID, size, uv0, uv1, framePadding, backgroundColor, tintColor); return ImGuiNative.igImageButton(userTextureID, size, uv0, uv1, framePadding, backgroundColor, tintColor);
} }
//obsolete!
public static bool CollapsingHeader(string label, string id, bool displayFrame, bool defaultOpen) public static bool CollapsingHeader(string label, string id, bool displayFrame, bool defaultOpen)
{ {
return ImGuiNative.igCollapsingHeader(label, id, displayFrame, defaultOpen); TreeNodeFlags default_open_flags = TreeNodeFlags.DefaultOpen;
return ImGuiNative.igCollapsingHeader(label, (defaultOpen ? default_open_flags : 0));
}
public static bool CollapsingHeader(string label, TreeNodeFlags flags)
{
return ImGuiNative.igCollapsingHeader(label, flags);
} }
public static bool Checkbox(string label, ref bool value) public static bool Checkbox(string label, ref bool value)

@ -71,10 +71,6 @@ namespace ImGuiNET
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern DrawList* igGetWindowDrawList(); public static extern DrawList* igGetWindowDrawList();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern NativeFont* igGetWindowFont();
[DllImport(cimguiLib)]
public static extern float igGetWindowFontSize();
[DllImport(cimguiLib)]
public static extern void igSetWindowFontScale(float scale); public static extern void igSetWindowFontScale(float scale);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igGetWindowPos(out Vector2 @out); public static extern void igGetWindowPos(out Vector2 @out);
@ -103,13 +99,13 @@ namespace ImGuiNET
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetNextWindowFocus(); public static extern void igSetNextWindowFocus();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetWindowPos(Vector2 pos, SetCondition cond); public static extern void igSetWindowPos(Vector2 pos, SetCondition cond); //(not recommended)
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetWindowSize(Vector2 size, SetCondition cond); public static extern void igSetWindowSize(Vector2 size, SetCondition cond); //(not recommended)
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetWindowCollapsed(bool collapsed, SetCondition cond); public static extern void igSetWindowCollapsed(bool collapsed, SetCondition cond); //(not recommended)
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetWindowFocus(); public static extern void igSetWindowFocus(); //(not recommended)
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetWindowPosByName(string name, Vector2 pos, SetCondition cond); public static extern void igSetWindowPosByName(string name, Vector2 pos, SetCondition cond);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -160,6 +156,10 @@ namespace ImGuiNET
public static extern void igPushStyleVarVec(StyleVar idx, Vector2 val); public static extern void igPushStyleVarVec(StyleVar idx, Vector2 val);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igPopStyleVar(int count); public static extern void igPopStyleVar(int count);
[DllImport(cimguiLib)]
public static extern NativeFont* igGetFont();
[DllImport(cimguiLib)]
public static extern float igGetFontSize();
// Parameters stacks (current window) // Parameters stacks (current window)
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -183,10 +183,6 @@ namespace ImGuiNET
// Layout // Layout
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igBeginGroup();
[DllImport(cimguiLib)]
public static extern void igEndGroup();
[DllImport(cimguiLib)]
public static extern void igSeparator(); public static extern void igSeparator();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSameLine(float local_pos_x, float spacing_w); public static extern void igSameLine(float local_pos_x, float spacing_w);
@ -195,23 +191,13 @@ namespace ImGuiNET
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igDummy(Vector2* size); public static extern void igDummy(Vector2* size);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igIndent(); public static extern void igIndent(float indent_w = 0.0f);
[DllImport(cimguiLib)]
public static extern void igUnindent();
[DllImport(cimguiLib)]
public static extern void igColumns(int count, string id, bool border);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igNextColumn(); public static extern void igUnindent(float indent_w = 0.0f);
[DllImport(cimguiLib)]
public static extern int igGetColumnIndex();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern float igGetColumnOffset(int column_index); public static extern void igBeginGroup();
[DllImport(cimguiLib)]
public static extern void igSetColumnOffset(int column_index, float offset_x);
[DllImport(cimguiLib)]
public static extern float igGetColumnWidth(int column_index);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern int igGetColumnsCount(); public static extern void igEndGroup();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igGetCursorPos(Vector2* pOut); public static extern void igGetCursorPos(Vector2* pOut);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -239,6 +225,23 @@ namespace ImGuiNET
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern float igGetItemsLineHeightWithSpacing(); public static extern float igGetItemsLineHeightWithSpacing();
// Columns
[DllImport(cimguiLib)]
public static extern void igColumns(int count, string id, bool border);
[DllImport(cimguiLib)]
public static extern void igNextColumn();
[DllImport(cimguiLib)]
public static extern int igGetColumnIndex();
[DllImport(cimguiLib)]
public static extern float igGetColumnOffset(int column_index);
[DllImport(cimguiLib)]
public static extern void igSetColumnOffset(int column_index, float offset_x);
[DllImport(cimguiLib)]
public static extern float igGetColumnWidth(int column_index);
[DllImport(cimguiLib)]
public static extern int igGetColumnsCount();
// ID scopes // ID scopes
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them // If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
// You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide') // You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
@ -298,9 +301,6 @@ namespace ImGuiNET
public static extern bool igImageButton(IntPtr user_texture_id, Vector2 size, Vector2 uv0, Vector2 uv1, int frame_padding, Vector4 bg_col, Vector4 tint_col); public static extern bool igImageButton(IntPtr user_texture_id, Vector2 size, Vector2 uv0, Vector2 uv1, int frame_padding, Vector4 bg_col, Vector4 tint_col);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)] [return: MarshalAs(UnmanagedType.I1)]
public static extern bool igCollapsingHeader(string label, string str_id, bool display_frame, bool default_open);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igCheckbox(string label, ref bool v); public static extern bool igCheckbox(string label, ref bool v);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)] [return: MarshalAs(UnmanagedType.I1)]
@ -471,6 +471,12 @@ namespace ImGuiNET
public static extern void igTreePop(); public static extern void igTreePop();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetNextTreeNodeOpened(bool opened, SetCondition cond); public static extern void igSetNextTreeNodeOpened(bool opened, SetCondition cond);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igCollapsingHeader(string label, TreeNodeFlags flags = 0);
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igCollapsingHeader(string label, ref bool p_open, TreeNodeFlags flags = 0);
// Widgets: Selectable / Lists // Widgets: Selectable / Lists
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -645,12 +651,6 @@ namespace ImGuiNET
public static extern float igGetTime(); public static extern float igGetTime();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern int igGetFrameCount(); public static extern int igGetFrameCount();
internal static void igPushFont(object nativeFont)
{
throw new NotImplementedException();
}
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern string igGetStyleColName(ColorTarget idx); public static extern string igGetStyleColName(ColorTarget idx);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -738,12 +738,12 @@ namespace ImGuiNET
// public state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself // public state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern string igGetVersion(); public static extern string igGetVersion();
[DllImport(cimguiLib)] /*
public static extern void* igGetpublicState(); CIMGUI_API struct ImGuiContext* igCreateContext(void* (*malloc_fn)(size_t), void (*free_fn)(void*));
[DllImport(cimguiLib)] CIMGUI_API void igDestroyContext(struct ImGuiContext* ctx);
public static extern uint igGetpublicStateSize(); CIMGUI_API struct ImGuiContext* igGetCurrentContext();
[DllImport(cimguiLib)] CIMGUI_API void igSetCurrentContext(struct ImGuiContext* ctx);
public static extern void igSetpublicState(void* state, bool construct); */
[DllImport(cimguiLib)] [DllImport(cimguiLib)]

@ -105,6 +105,12 @@ namespace ImGuiNET
/// </summary> /// </summary>
public Vector2 DisplayVisibleMax; // <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize public Vector2 DisplayVisibleMax; // <unset> (0.0f,0.0f) // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize
public byte WordMovementUsesAltKey; // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl
public byte ShortcutsUseSuperKey; // = defined(__APPLE__) // OS X style: Shortcuts using Cmd/Super instead of Ctrl
public byte DoubleClickSelectsWord; // = defined(__APPLE__) // OS X style: Double click selects by word instead of selecting whole text
public byte MultiSelectUsesSuperKey; // = defined(__APPLE__) // OS X style: Multi-selection in lists uses Cmd/Super instead of Ctrl [unused yet]
//------------------------------------------------------------------ //------------------------------------------------------------------
// User Functions // User Functions
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -181,6 +187,7 @@ namespace ImGuiNET
/// Keyboard modifier pressed: Alt /// Keyboard modifier pressed: Alt
/// </summary> /// </summary>
public byte KeyAlt; public byte KeyAlt;
public byte KeySuper;
/// <summary> /// <summary>
/// Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data) /// Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
/// </summary> /// </summary>

@ -51,10 +51,6 @@ namespace ImGuiNET
/// </summary> /// </summary>
public Vector2 TouchExtraPadding; public Vector2 TouchExtraPadding;
/// <summary> /// <summary>
/// Default alpha of window background, if not specified in ImGui::Begin().
/// </summary>
public float WindowFillAlphaDefault;
/// <summary>
/// Horizontal indentation when e.g. entering a tree node /// Horizontal indentation when e.g. entering a tree node
/// </summary> /// </summary>
public float IndentSpacing; public float IndentSpacing;

@ -110,15 +110,6 @@ namespace ImGuiNET
set { _stylePtr->TouchExtraPadding = value; } set { _stylePtr->TouchExtraPadding = value; }
} }
/// <summary>
/// Default alpha of window background, if not specified in ImGui::Begin().
/// </summary>
public float WindowFillAlphaDefault
{
get { return _stylePtr->WindowFillAlphaDefault; }
set { _stylePtr->WindowFillAlphaDefault = value; }
}
/// <summary> /// <summary>
/// Horizontal indentation when e.g. entering a tree node /// Horizontal indentation when e.g. entering a tree node
/// </summary> /// </summary>

@ -39,6 +39,8 @@ namespace ImGuiNET
/// Current text. Read-write (pointed data only). char* in native code. /// Current text. Read-write (pointed data only). char* in native code.
/// </summary> /// </summary>
public IntPtr Buf; public IntPtr Buf;
public int BufTextLen;
/// <summary> /// <summary>
/// Read-only. /// Read-only.
/// </summary> /// </summary>

@ -0,0 +1,51 @@
using System;
namespace ImGuiNET
{
[Flags]
public enum TreeNodeFlags : int
{
/// <summary>
/// Draw as selected
/// </summary>
Selected = 1 << 0,
/// <summary>
/// Full colored frame (e.g. for CollapsingHeader)
/// </summary>
Framed = 1 << 1,
/// <summary>
/// Hit testing to allow subsequent widgets to overlap this one
/// </summary>
AllowOverlapMode = 1 << 2,
/// <summary>
/// Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack
/// </summary>
NoTreePushOnOpen = 1 << 3,
/// <summary>
/// Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack
/// </summary>
NoAutoOpenOnLog = 1 << 4,
/// <summary>
/// Default node to be open
/// </summary>
DefaultOpen = 1 << 5,
/// <summary>
/// Need double-click to open node
/// </summary>
OpenOnDoubleClick = 1 << 6,
/// <summary>
/// Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.
/// </summary>
OpenOnArrow = 1 << 7,
/// <summary>
/// No collapsing, no arrow (use as a convenience for leaf nodes).
/// </summary>
Leaf = 1 << 8,
/// <summary>
/// Display a bullet instead of arrow
/// </summary>
Bullet = 1 << 9,
CollapsingHeader = Framed | NoAutoOpenOnLog
};
}
Loading…
Cancel
Save