update to (c)imgui 1.49

internals
David Pethes 8 years ago
parent 4f125f7b0e
commit 0a9f9fac76
  1. 64
      src/ImGui.NET/Font.cs
  2. 9
      src/ImGui.NET/ImGui.cs
  3. 45
      src/ImGui.NET/ImGuiNative.cs
  4. 7
      src/ImGui.NET/NativeIO.cs
  5. 4
      src/ImGui.NET/NativeStyle.cs
  6. 9
      src/ImGui.NET/Style.cs
  7. 2
      src/ImGui.NET/TextEditCallbackData.cs

@ -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;
}; };
} }

@ -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)
{
int default_open_flags = 1 << 5;
return ImGuiNative.igCollapsingHeader(label, (defaultOpen ? default_open_flags : 0));
}
public static bool CollapsingHeader(string label, int flags)
{ {
return ImGuiNative.igCollapsingHeader(label, id, displayFrame, defaultOpen); 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);
@ -102,14 +98,14 @@ namespace ImGuiNET
public static extern void igSetNextWindowCollapsed(bool collapsed, SetCondition cond); public static extern void igSetNextWindowCollapsed(bool collapsed, SetCondition cond);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetNextWindowFocus(); public static extern void igSetNextWindowFocus();
[DllImport(cimguiLib)]
public static extern void igSetWindowPos(Vector2 pos, SetCondition cond); //(not recommended)
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igSetWindowPos(Vector2 pos, SetCondition cond); public static extern void igSetWindowSize(Vector2 size, SetCondition cond); //(not recommended)
[DllImport(cimguiLib)]
public static extern void igSetWindowSize(Vector2 size, SetCondition cond);
[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)]
@ -298,9 +298,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 +468,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, int flags); //ImGuiTreeNodeFlags
[DllImport(cimguiLib)]
[return: MarshalAs(UnmanagedType.I1)]
public static extern bool igCollapsingHeader(string label, ref bool p_open, int flags); //ImGuiTreeNodeFlags
// Widgets: Selectable / Lists // Widgets: Selectable / Lists
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -645,12 +648,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 +735,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>

Loading…
Cancel
Save