Merge pull request #2 from mellinoe/dev

Changes from dev branch
internals
Eric Mellino 9 years ago
commit 14a6fc2172
  1. 2
      src/ImGui.NET/Align.cs
  2. 2
      src/ImGui.NET/ColorEditMode.cs
  3. 2
      src/ImGui.NET/ColorTarget.cs
  4. 2
      src/ImGui.NET/DrawCmd.cs
  5. 2
      src/ImGui.NET/DrawData.cs
  6. 2
      src/ImGui.NET/DrawList.cs
  7. 2
      src/ImGui.NET/DrawVert.cs
  8. 2
      src/ImGui.NET/Font.cs
  9. 2
      src/ImGui.NET/FontAtlas.cs
  10. 2
      src/ImGui.NET/FontConfig.cs
  11. 2
      src/ImGui.NET/GuiKey.cs
  12. 2
      src/ImGui.NET/IO.cs
  13. 6
      src/ImGui.NET/ImGui.NET.csproj
  14. 244
      src/ImGui.NET/ImGui.cs
  15. 53
      src/ImGui.NET/ImGuiNative.cs
  16. 2
      src/ImGui.NET/ImVector.cs
  17. 2
      src/ImGui.NET/InputTextFlags.cs
  18. 2
      src/ImGui.NET/MouseCursorKind.cs
  19. 2
      src/ImGui.NET/SelectableFlags.cs
  20. 2
      src/ImGui.NET/SetCondition.cs
  21. 2
      src/ImGui.NET/Storage.cs
  22. 2
      src/ImGui.NET/Style.cs
  23. 2
      src/ImGui.NET/StyleVar.cs
  24. 2
      src/ImGui.NET/TextEditCallback.cs
  25. 2
      src/ImGui.NET/TextEditCallbackData.cs
  26. 49
      src/ImGui.NET/TextInputBuffer.cs
  27. 2
      src/ImGui.NET/WindowFlags.cs
  28. 3
      src/ImGui.NET/project.json

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
public enum Align public enum Align
{ {

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Enumeration for ColorEditMode() /// Enumeration for ColorEditMode()

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Enumeration for PushStyleColor() / PopStyleColor() /// Enumeration for PushStyleColor() / PopStyleColor()

@ -2,7 +2,7 @@
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Typically, 1 command = 1 gpu draw call (unless command is a callback) /// Typically, 1 command = 1 gpu draw call (unless command is a callback)

@ -1,6 +1,6 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
// All draw data to render an ImGui frame // All draw data to render an ImGui frame
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Draw command list /// Draw command list

@ -1,7 +1,7 @@
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct DrawVert public unsafe struct DrawVert

@ -2,7 +2,7 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Numerics; using System.Numerics;
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Font runtime data and rendering. /// Font runtime data and rendering.

@ -2,7 +2,7 @@
using System; using System;
using System.Numerics; using System.Numerics;
namespace ImGui namespace ImGuiNET
{ {
// Load and rasterize multiple TTF fonts into a same texture. // Load and rasterize multiple TTF fonts into a same texture.
// Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering. // Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering.

@ -2,7 +2,7 @@
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct FontConfig public unsafe struct FontConfig

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array /// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array

@ -2,7 +2,7 @@
using System.Numerics; using System.Numerics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct IO public unsafe struct IO

@ -5,7 +5,7 @@
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
<ProjectGuid>{2665014F-0FEC-4268-8F77-7B029921AB09}</ProjectGuid> <ProjectGuid>{2665014F-0FEC-4268-8F77-7B029921AB09}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>ImGui</RootNamespace> <RootNamespace>ImGuiNET</RootNamespace>
<AssemblyName>ImGui.NET</AssemblyName> <AssemblyName>ImGui.NET</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
@ -15,6 +15,7 @@
<Compile Include="MouseCursorKind.cs" /> <Compile Include="MouseCursorKind.cs" />
<Compile Include="SelectableFlags.cs" /> <Compile Include="SelectableFlags.cs" />
<Compile Include="StyleVar.cs" /> <Compile Include="StyleVar.cs" />
<Compile Include="TextInputBuffer.cs" />
<Compile Include="WindowFlags.cs" /> <Compile Include="WindowFlags.cs" />
<Compile Include="ColorEditMode.cs" /> <Compile Include="ColorEditMode.cs" />
<Compile Include="GuiKey.cs" /> <Compile Include="GuiKey.cs" />
@ -80,6 +81,9 @@
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<UseVSHostingProcess>true</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="project.json" /> <None Include="project.json" />
</ItemGroup> </ItemGroup>

@ -1,6 +1,8 @@
using System.Numerics; using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
public static class ImGui public static class ImGui
{ {
@ -25,6 +27,16 @@ namespace ImGui
ImGuiNative.igText(message); ImGuiNative.igText(message);
} }
public static void PushId(string id)
{
ImGuiNative.igPushIdStr(id);
}
public static void PopId()
{
ImGuiNative.igPopId();
}
public static void Text(string message, Vector4 color) public static void Text(string message, Vector4 color)
{ {
ImGuiNative.igTextColored(color, message); ImGuiNative.igTextColored(color, message);
@ -35,6 +47,16 @@ namespace ImGui
return ImGuiNative.igButton(message, size); return ImGuiNative.igButton(message, size);
} }
public static void SetNextWindowSize(Vector2 size, SetCondition condition)
{
ImGuiNative.igSetNextWindowSize(size, condition);
}
public static void SetNextWindowPosCenter(SetCondition condition)
{
ImGuiNative.igSetNextWindowPosCenter(condition);
}
/// <summary> /// <summary>
/// Helper to scale the ClipRect field of each ImDrawCmd. /// Helper to scale the ClipRect field of each ImDrawCmd.
/// Use if your final output buffer is at a different scale than ImGui expects, /// Use if your final output buffer is at a different scale than ImGui expects,
@ -55,5 +77,223 @@ namespace ImGui
} }
} }
} }
public static float GetWindowHeight()
{
return ImGuiNative.igGetWindowHeight();
}
public static bool ColorButton(Vector4 color, bool smallHeight, bool outlineBorder)
{
return ImGuiNative.igColorButton(color, smallHeight, outlineBorder);
}
public static float GetWindowWidth()
{
return ImGuiNative.igGetWindowWidth();
}
public static bool BeginWindow(string windowTitle) => BeginWindow(windowTitle, WindowFlags.Default);
public static bool BeginWindow(string windowTitle, WindowFlags flags)
{
bool opened = true;
return ImGuiNative.igBegin(windowTitle, ref opened, flags);
}
public static bool BeginWindow(string windowTitle, ref bool opened, WindowFlags flags)
{
return ImGuiNative.igBegin(windowTitle, ref opened, flags);
}
public static bool BeginWindow(string windowTitle, ref bool opened, float backgroundAlpha, WindowFlags flags)
{
return ImGuiNative.igBegin2(windowTitle, ref opened, new Vector2(), backgroundAlpha, flags);
}
public static bool BeginMenu(string label, bool enabled)
{
return ImGuiNative.igBeginMenu(label, enabled);
}
public static void BeginMenuBar()
{
ImGuiNative.igBeginMenuBar();
}
public static void CloseCurrentPopup()
{
ImGuiNative.igCloseCurrentPopup();
}
public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, WindowFlags flags)
{
return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, 1f, flags);
}
public static unsafe bool Checkbox(string label, ref bool value)
{
bool localVal = value;
bool result = ImGuiNative.igCheckbox(label, &localVal);
value = localVal;
return result;
}
public static void EndMenuBar()
{
ImGuiNative.igEndMenuBar();
}
public static void EndMenu()
{
ImGuiNative.igEndMenu();
}
public static bool BeginWindow(string windowTitle, ref bool opened, Vector2 startingSize, float backgroundAlpha, WindowFlags flags)
{
return ImGuiNative.igBegin2(windowTitle, ref opened, startingSize, backgroundAlpha, flags);
}
public static void Separator()
{
ImGuiNative.igSeparator();
}
public static bool MenuItem(string label, string shortcut)
{
return MenuItem(label, shortcut, false, true);
}
public static unsafe bool InputText(string label, IntPtr textBuffer, uint bufferSize, InputTextFlags flags, TextEditCallback textEditCallback)
{
return InputText(label, textBuffer, bufferSize, flags, textEditCallback, IntPtr.Zero);
}
public static unsafe bool InputText(string label, IntPtr textBuffer, uint bufferSize, InputTextFlags flags, TextEditCallback textEditCallback, IntPtr userData)
{
return ImGuiNative.igInputText(label, textBuffer, bufferSize, flags, textEditCallback, userData.ToPointer());
}
public static bool MenuItem(string label, string shortcut, bool selected, bool enabled)
{
return ImGuiNative.igMenuItem(label, shortcut, selected, enabled);
}
public static void EndWindow()
{
ImGuiNative.igEnd();
}
public static void PushStyleColor(ColorTarget target, Vector4 color)
{
ImGuiNative.igPushStyleColor(target, color);
}
public static unsafe void InputTextMultiline(string label, IntPtr textBuffer, uint bufferSize, Vector2 size, InputTextFlags flags, TextEditCallback callback, IntPtr userData)
{
ImGuiNative.igInputTextMultiline(label, textBuffer, bufferSize, size, flags, callback, userData.ToPointer());
}
public static void PopStyleColor()
{
PopStyleColor(1);
}
public static void PopStyleColor(int numStyles)
{
ImGuiNative.igPopStyleColor(numStyles);
}
public static bool BeginChildFrame(uint id, Vector2 size, WindowFlags flags)
{
return ImGuiNative.igBeginChildFrame(id, size, flags);
}
public static void EndChildFrame()
{
ImGuiNative.igEndChildFrame();
}
public static bool BeginChild(string id, Vector2 size, bool border, WindowFlags flags)
{
return ImGuiNative.igBeginChild(id, size, border, flags);
}
public static bool BeginChild(uint id, Vector2 size, bool border, WindowFlags flags)
{
return ImGuiNative.igBeginChildEx(id, size, border, flags);
}
public static void EndChild()
{
ImGuiNative.igEndChild();
}
public static bool Selectable(string label, bool isSelected)
{
return Selectable(label, isSelected, SelectableFlags.Default);
}
public static bool Selectable(string label, bool isSelected, SelectableFlags flags)
{
return Selectable(label, isSelected, flags, new Vector2());
}
public static bool Selectable(string label, bool isSelected, SelectableFlags flags, Vector2 size)
{
return ImGuiNative.igSelectable(label, isSelected, flags, size);
}
public static unsafe Vector2 GetTextSize(string text, float wrapWidth = Int32.MaxValue)
{
Vector2 result;
IntPtr buffer = Marshal.StringToHGlobalAnsi(text);
byte* textStart = (byte*)buffer.ToPointer();
byte* textEnd = textStart + text.Length;
ImGuiNative.igCalcTextSize(out result, (char*)textStart, (char*)textEnd, false, wrapWidth);
return result;
}
public static void SameLine()
{
ImGuiNative.igSameLine(0, 0);
}
public static void SameLine(float localPositionX, float spacingW)
{
ImGuiNative.igSameLine(localPositionX, spacingW);
}
public static bool IsLastItemHovered()
{
return ImGuiNative.igIsItemHovered();
}
public static void ShowTooltip(string text)
{
ImGuiNative.igSetTooltip(text);
}
public static void SetNextTreeNodeOpened(bool opened)
{
ImGuiNative.igSetNextTreeNodeOpened(opened, SetCondition.Always);
}
public static bool TreeNode(string label)
{
return ImGuiNative.igTreeNode(label);
}
public static void TreePop()
{
ImGuiNative.igTreePop();
}
public static Vector2 GetLastItemRect()
{
Vector2 result;
ImGuiNative.igGetItemRectSize(out result);
return result;
}
} }
} }

@ -2,7 +2,7 @@
using System.Numerics; using System.Numerics;
using System; using System;
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Contains all of the exported functions from the native (c)imGui module. /// Contains all of the exported functions from the native (c)imGui module.
@ -30,6 +30,7 @@ namespace ImGui
public static extern void igShowUserGuide(); public static extern void igShowUserGuide();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igShowStyleEditor(ref Style @ref); public static extern void igShowStyleEditor(ref Style @ref);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igShowTestWindow(ref bool opened); public static extern void igShowTestWindow(ref bool opened);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -52,6 +53,7 @@ namespace ImGui
public static extern void igGetContentRegionMax(out Vector2 @out); public static extern void igGetContentRegionMax(out Vector2 @out);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igGetContentRegionAvail(out Vector2 @out); public static extern void igGetContentRegionAvail(out Vector2 @out);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern float igGetContentRegionAvailWidth(); public static extern float igGetContentRegionAvailWidth();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -263,7 +265,7 @@ namespace ImGui
public static extern void igTextWrapped(string fmt); public static extern void igTextWrapped(string fmt);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igTextUnformatted(string text, string text_end); public static extern void igTextUnformatted(byte* text, byte* text_end);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igLabelText(string label, string fmt); public static extern void igLabelText(string label, string fmt);
@ -399,20 +401,11 @@ namespace ImGui
public static extern bool igTreeNode(string str_label_id); public static extern bool igTreeNode(string str_label_id);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
//public static extern bool igTreeNodeStr(string str_id, string fmt, ...);
public static extern bool igTreeNodeStr(string str_id, string fmt); public static extern bool igTreeNodeStr(string str_id, string fmt);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
//public static extern bool igTreeNodePtr(void* ptr_id, string fmt, ...);
public static extern bool igTreeNodePtr(void* ptr_id, string fmt); public static extern bool igTreeNodePtr(void* ptr_id, string fmt);
/*
[DllImport(LibName)]
public static extern bool igTreeNodeStrV(string str_id, string fmt, va_list args);
[DllImport(LibName)]
public static extern bool igTreeNodePtrV(void* ptr_id, string fmt, va_list args);
*/
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igTreePushStr(string str_id); public static extern void igTreePushStr(string str_id);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -426,7 +419,7 @@ namespace ImGui
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern bool igSelectable(string label, bool selected, SelectableFlags flags, Vector2 size); public static extern bool igSelectable(string label, bool selected, SelectableFlags flags, Vector2 size);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern bool igSelectableEx(string label, bool* p_selected, SelectableFlags flags, Vector2 size); public static extern bool igSelectableEx(string label, ref bool p_selected, SelectableFlags flags, Vector2 size);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern bool igListBox(string label, int* current_item, char** items, int items_count, int height_in_items); public static extern bool igListBox(string label, int* current_item, char** items, int items_count, int height_in_items);
@ -456,14 +449,7 @@ namespace ImGui
// Tooltip // Tooltip
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
//public static extern void igSetTooltip(string fmt, ...);
public static extern void igSetTooltip(string fmt); public static extern void igSetTooltip(string fmt);
/*
[DllImport(LibName)]
public static extern void igSetTooltipV(string fmt, va_list args);
*/
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igBeginTooltip(); public static extern void igBeginTooltip();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -494,8 +480,23 @@ namespace ImGui
public static extern void igOpenPopup(string str_id); public static extern void igOpenPopup(string str_id);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern bool igBeginPopup(string str_id); public static extern bool igBeginPopup(string str_id);
[DllImport(cimguiLib)] [DllImport(cimguiLib, CharSet = CharSet.Ansi)]
public static extern bool igBeginPopupModal(string name, ref bool p_opened, WindowFlags extra_flags); public static extern bool igBeginPopupModal(string name, byte* p_opened, WindowFlags extra_flags);
public static bool igBeginPopupModal(string name, WindowFlags extra_flags)
{
return igBeginPopupModal(name, null, extra_flags);
}
public static bool igBeginPopupModal(string name, ref bool p_opened, WindowFlags extra_flags)
{
byte value = p_opened ? (byte)1 : (byte)0;
bool result = igBeginPopupModal(name, &value, extra_flags);
p_opened = value == 1 ? true : false;
return result;
}
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern bool igBeginPopupContextItem(string str_id, int mouse_button); public static extern bool igBeginPopupContextItem(string str_id, int mouse_button);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -537,11 +538,11 @@ namespace ImGui
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern bool igIsAnyItemActive(); public static extern bool igIsAnyItemActive();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igGetItemRectMin(Vector2* pOut); public static extern void igGetItemRectMin(out Vector2 pOut);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igGetItemRectMax(Vector2* pOut); public static extern void igGetItemRectMax(out Vector2 pOut);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igGetItemRectSize(Vector2* pOut); public static extern void igGetItemRectSize(out Vector2 pOut);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern bool igIsWindowHovered(); public static extern bool igIsWindowHovered();
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
@ -561,9 +562,9 @@ namespace ImGui
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern string igGetStyleColName(ColorTarget idx); public static extern string igGetStyleColName(ColorTarget idx);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igCalcItemRectClosestPoint(Vector2* pOut, Vector2 pos, bool on_edge, float outward); public static extern void igCalcItemRectClosestPoint(out Vector2 pOut, Vector2 pos, bool on_edge, float outward);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igCalcTextSize(Vector2* pOut, string text, string text_end, bool hide_text_after_double_hash, float wrap_width); public static extern void igCalcTextSize(out Vector2 pOut, char* text, char* text_end, bool hide_text_after_double_hash, float wrap_width);
[DllImport(cimguiLib)] [DllImport(cimguiLib)]
public static extern void igCalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); public static extern void igCalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);

@ -1,6 +1,6 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct ImVector public unsafe struct ImVector

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Flags for ImGui.InputText() /// Flags for ImGui.InputText()

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Enumeration for GetMouseCursor() /// Enumeration for GetMouseCursor()

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Flags for ImGui::Selectable() /// Flags for ImGui::Selectable()

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions. /// Condition flags for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions.

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct Storage public unsafe struct Storage

@ -1,7 +1,7 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Numerics; using System.Numerics;
namespace ImGui namespace ImGuiNET
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct Style public unsafe struct Style

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Enumeration for PushStyleVar() / PopStyleVar() /// Enumeration for PushStyleVar() / PopStyleVar()

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
public unsafe delegate int TextEditCallback(TextEditCallbackData* data); public unsafe delegate int TextEditCallback(TextEditCallbackData* data);
} }

@ -1,7 +1,7 @@
using System; using System;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace ImGui namespace ImGuiNET
{ {
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public unsafe struct TextEditCallbackData public unsafe struct TextEditCallbackData

@ -0,0 +1,49 @@
using System;
using System.Runtime.InteropServices;
namespace ImGuiNET
{
public class TextInputBuffer : IDisposable
{
public IntPtr Buffer { get; private set; }
public uint Length { get; private set; }
public TextInputBuffer(int length)
{
CreateBuffer(length);
}
public TextInputBuffer(string initialText)
{
Buffer = Marshal.StringToHGlobalAnsi(initialText);
Length = (uint)initialText.Length;
}
public void Resize(int newSize)
{
ClearBuffer();
CreateBuffer(newSize);
}
private void CreateBuffer(int size)
{
Buffer = Marshal.AllocHGlobal(size);
Length = Length;
}
private void ClearBuffer()
{
Marshal.FreeHGlobal(Buffer);
Buffer = IntPtr.Zero;
Length = 0;
}
public void Dispose()
{
if (Buffer != IntPtr.Zero)
{
ClearBuffer();
}
}
}
}

@ -1,4 +1,4 @@
namespace ImGui namespace ImGuiNET
{ {
/// <summary> /// <summary>
/// Flags for ImGui::Begin() /// Flags for ImGui::Begin()

@ -1,7 +1,6 @@
{ {
"dependencies": { "dependencies": {
"Microsoft.NETCore.Console": "1.0.0-beta-23413", "Microsoft.NETCore.Console": "1.0.0-beta-23504"
"System.Console": "4.0.0-beta-23427"
}, },
"runtimes": { "runtimes": {
"win10-x64": { }, "win10-x64": { },

Loading…
Cancel
Save