Merge remote-tracking branch 'origin/master' into ImPlot_ImNodes_ImGuizmo_Integration

# Conflicts:
#	src/ImGui.NET.SampleProgram/ImGui.NET.SampleProgram.csproj
internals
Alex Hildebrand 4 years ago
commit a5a66dd8ed
  1. 2
      src/CodeGenerator/CodeGenerator.csproj
  2. 2
      src/ImGui.NET.SampleProgram.XNA/ImGui.NET.SampleProgram.XNA.csproj
  3. 11
      src/ImGui.NET.SampleProgram.XNA/ImGuiRenderer.cs
  4. 4
      src/ImGui.NET.SampleProgram/ImGui.NET.SampleProgram.csproj
  5. 1
      src/ImGui.NET.SampleProgram/ImGuiController.cs
  6. 108
      src/ImGui.NET/ImGui.Manual.cs

@ -24,6 +24,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
</Project>

@ -20,7 +20,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.7.0.1708" />
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.0.1641" />
</ItemGroup>
</Project>

@ -158,6 +158,7 @@ namespace ImGuiNET.SampleProgram.XNA
_keys.Add(io.KeyMap[(int)ImGuiKey.Backspace] = (int)Keys.Back);
_keys.Add(io.KeyMap[(int)ImGuiKey.Enter] = (int)Keys.Enter);
_keys.Add(io.KeyMap[(int)ImGuiKey.Escape] = (int)Keys.Escape);
_keys.Add(io.KeyMap[(int)ImGuiKey.Space] = (int)Keys.Space);
_keys.Add(io.KeyMap[(int)ImGuiKey.A] = (int)Keys.A);
_keys.Add(io.KeyMap[(int)ImGuiKey.C] = (int)Keys.C);
_keys.Add(io.KeyMap[(int)ImGuiKey.V] = (int)Keys.V);
@ -195,17 +196,9 @@ namespace ImGuiNET.SampleProgram.XNA
var io = ImGui.GetIO();
// MonoGame-specific //////////////////////
var offset = .5f;
///////////////////////////////////////////
// FNA-specific ///////////////////////////
//var offset = 0f;
///////////////////////////////////////////
_effect.World = Matrix.Identity;
_effect.View = Matrix.Identity;
_effect.Projection = Matrix.CreateOrthographicOffCenter(offset, io.DisplaySize.X + offset, io.DisplaySize.Y + offset, offset, -1f, 1f);
_effect.Projection = Matrix.CreateOrthographicOffCenter(0f, io.DisplaySize.X, io.DisplaySize.Y, 0f, -1f, 1f);
_effect.TextureEnabled = true;
_effect.Texture = texture;
_effect.VertexColorEnabled = true;

@ -8,8 +8,8 @@
<ItemGroup>
<ProjectReference Include="..\ImGui.NET\ImGui.NET.csproj" />
<PackageReference Include="Veldrid" Version="4.3.3" />
<PackageReference Include="Veldrid.StartupUtilities" Version="4.3.3" />
<PackageReference Include="Veldrid" Version="4.8.0" />
<PackageReference Include="Veldrid.StartupUtilities" Version="4.8.0" />
<ProjectReference Include="..\ImPlot.NET\ImPlot.NET.csproj" />
</ItemGroup>

@ -416,6 +416,7 @@ namespace ImGuiNET
io.KeyMap[(int)ImGuiKey.Backspace] = (int)Key.BackSpace;
io.KeyMap[(int)ImGuiKey.Enter] = (int)Key.Enter;
io.KeyMap[(int)ImGuiKey.Escape] = (int)Key.Escape;
io.KeyMap[(int)ImGuiKey.Space] = (int)Key.Space;
io.KeyMap[(int)ImGuiKey.A] = (int)Key.A;
io.KeyMap[(int)ImGuiKey.C] = (int)Key.C;
io.KeyMap[(int)ImGuiKey.V] = (int)Key.V;

@ -247,6 +247,114 @@ namespace ImGuiNET
return result != 0;
}
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength) => InputTextWithHint(label, hint, ref input, maxLength, 0, null, IntPtr.Zero);
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags) => InputTextWithHint(label, hint, ref input, maxLength, flags, null, IntPtr.Zero);
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback) => InputTextWithHint(label, hint, ref input, maxLength, flags, callback, IntPtr.Zero);
public static bool InputTextWithHint(
string label,
string hint,
ref string input,
uint maxLength,
ImGuiInputTextFlags flags,
ImGuiInputTextCallback callback,
IntPtr user_data)
{
int utf8LabelByteCount = Encoding.UTF8.GetByteCount(label);
byte* utf8LabelBytes;
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
utf8LabelBytes = Util.Allocate(utf8LabelByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8LabelByteCount + 1];
utf8LabelBytes = stackPtr;
}
Util.GetUtf8(label, utf8LabelBytes, utf8LabelByteCount);
int utf8HintByteCount = Encoding.UTF8.GetByteCount(hint);
byte* utf8HintBytes;
if (utf8HintByteCount > Util.StackAllocationSizeLimit)
{
utf8HintBytes = Util.Allocate(utf8HintByteCount + 1);
}
else
{
byte* stackPtr = stackalloc byte[utf8HintByteCount + 1];
utf8HintBytes = stackPtr;
}
Util.GetUtf8(hint, utf8HintBytes, utf8HintByteCount);
int utf8InputByteCount = Encoding.UTF8.GetByteCount(input);
int inputBufSize = Math.Max((int)maxLength + 1, utf8InputByteCount + 1);
byte* utf8InputBytes;
byte* originalUtf8InputBytes;
if (inputBufSize > Util.StackAllocationSizeLimit)
{
utf8InputBytes = Util.Allocate(inputBufSize);
originalUtf8InputBytes = Util.Allocate(inputBufSize);
}
else
{
byte* inputStackBytes = stackalloc byte[inputBufSize];
utf8InputBytes = inputStackBytes;
byte* originalInputStackBytes = stackalloc byte[inputBufSize];
originalUtf8InputBytes = originalInputStackBytes;
}
Util.GetUtf8(input, utf8InputBytes, inputBufSize);
uint clearBytesCount = (uint)(inputBufSize - utf8InputByteCount);
Unsafe.InitBlockUnaligned(utf8InputBytes + utf8InputByteCount, 0, clearBytesCount);
Unsafe.CopyBlock(originalUtf8InputBytes, utf8InputBytes, (uint)inputBufSize);
byte result = ImGuiNative.igInputTextWithHint(
utf8LabelBytes,
utf8HintBytes,
utf8InputBytes,
(uint)inputBufSize,
flags,
callback,
user_data.ToPointer());
if (!Util.AreStringsEqual(originalUtf8InputBytes, inputBufSize, utf8InputBytes))
{
input = Util.StringFromPtr(utf8InputBytes);
}
if (utf8LabelByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8LabelBytes);
}
if (utf8HintByteCount > Util.StackAllocationSizeLimit)
{
Util.Free(utf8HintBytes);
}
if (inputBufSize > Util.StackAllocationSizeLimit)
{
Util.Free(utf8InputBytes);
Util.Free(originalUtf8InputBytes);
}
return result != 0;
}
public static bool InputText(
string label,
IntPtr buf,

Loading…
Cancel
Save