mirror of
https://github.com/ahwootech/BRUTAL.git
synced 2026-11-28 05:58:25 +01:00
SOURCE DUMP v1
This commit is contained in:
parent
bd62d51ec9
commit
fb20299e9d
4 changed files with 768360 additions and 0 deletions
|
|
@ -0,0 +1,49 @@
|
|||
namespace Brutal.ImGuiApi;
|
||||
|
||||
[InlineArray(2)]
|
||||
public struct ImDrawDataBuilderLayers
|
||||
{
|
||||
public Ptr<ImVector<ImDrawListPtr>> Value;
|
||||
}
|
||||
|
||||
/// <summary>Helper to build a ImDrawData instance</summary>
|
||||
/// <remarks>ImDrawList/ImFontAtlas</remarks>
|
||||
/// <source href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui_internal.h#L142"><a href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui_internal.h#L142">imgui_internal.h:142</a></source>
|
||||
/// <br/>
|
||||
/// <declaration><c>struct ImDrawDataBuilder</c></declaration>
|
||||
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
||||
public partial struct ImDrawDataBuilder()
|
||||
{
|
||||
/// <summary>Pointers to global layers for: regular, tooltip. LayersP[0] is owned by DrawData.</summary>
|
||||
/// <source href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui_internal.h#L877"><a href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui_internal.h#L877">imgui_internal.h:877</a></source>
|
||||
/// <br/>
|
||||
/// <declaration><c>ImVector<ImDrawList*>* Layers[2]</c></declaration>
|
||||
[FieldOffset(0)]
|
||||
public ImDrawDataBuilderLayers Layers;
|
||||
|
||||
/// <summary/>
|
||||
/// <source href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui_internal.h#L878"><a href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui_internal.h#L878">imgui_internal.h:878</a></source>
|
||||
/// <br/>
|
||||
/// <declaration><c>ImVector<ImDrawList*> LayerData1</c></declaration>
|
||||
[FieldOffset(16)]
|
||||
public ImVector<ImDrawListPtr> LayerData1;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ImDrawDataBuilder"/>
|
||||
public unsafe partial struct ImDrawDataBuilderPtr(ImDrawDataBuilder* ptr) : INullable
|
||||
{
|
||||
private ImDrawDataBuilder* _ptr = ptr;
|
||||
public ImDrawDataBuilder* Ptr => _ptr;
|
||||
|
||||
public bool IsNull() => _ptr is null;
|
||||
|
||||
public static implicit operator ImDrawDataBuilderPtr(ImDrawDataBuilder* ptr) => new(ptr);
|
||||
|
||||
public static implicit operator ImDrawDataBuilder*(ImDrawDataBuilderPtr wrapper) => wrapper.Ptr;
|
||||
|
||||
/// <inheritdoc cref="ImDrawDataBuilder.Layers"/>
|
||||
public ref ImDrawDataBuilderLayers Layers => ref Unsafe.AsRef<ImDrawDataBuilderLayers>(&_ptr->Layers);
|
||||
|
||||
/// <inheritdoc cref="ImDrawDataBuilder.LayerData1"/>
|
||||
public ref ImVector<ImDrawListPtr> LayerData1 => ref Unsafe.AsRef<ImVector<ImDrawListPtr>>(&_ptr->LayerData1);
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
namespace Brutal.ImGuiApi;
|
||||
|
||||
public partial struct ImGuiListClipper : IDisposable
|
||||
{
|
||||
/// <inheritdoc cref="ImGuiListClipperExtensions.End"/>
|
||||
public void Dispose() => this.End();
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
namespace Brutal.ImGuiApi;
|
||||
|
||||
/// <summary>Helper: Execute a block of code at maximum once a frame. </summary>
|
||||
/// <remarks>
|
||||
/// Convenient if you want to quickly create a UI within deep-nested code that runs multiple times every frame.<br/>
|
||||
/// Usage: static ImGuiOnceUponAFrame oaf = new(); if (oaf) ImGui.Text("This will be called only once per frame");
|
||||
/// </remarks>
|
||||
/// <source href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui.h#L194"><a href="https://github.com/ocornut/imgui/blob/v1.92.2-docking/imgui.h#L194">imgui.h:194</a></source>
|
||||
/// <br/>
|
||||
/// <declaration><c>struct ImGuiOnceUponAFrame</c></declaration>
|
||||
// A class, not a struct, so the implicit bool operator mutates the shared instance's _refFrame.
|
||||
public class ImGuiOnceUponAFrame
|
||||
{
|
||||
private int _refFrame = -1;
|
||||
|
||||
public static implicit operator bool(ImGuiOnceUponAFrame value)
|
||||
{
|
||||
var currentFrame = ImGui.GetFrameCount();
|
||||
|
||||
if (value._refFrame == currentFrame)
|
||||
return false;
|
||||
|
||||
value._refFrame = currentFrame;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
22
brutal.imgui/Brutal.ImGui/Manual/Structs/ImGuiTextRange.cs
Normal file
22
brutal.imgui/Brutal.ImGui/Manual/Structs/ImGuiTextRange.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Brutal.ImGuiApi;
|
||||
|
||||
public partial struct ImGuiTextFilter
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
||||
public unsafe struct ImGuiTextRange
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public byte* B;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public byte* E;
|
||||
|
||||
public ImGuiTextRange(ReadOnlySpan<byte> range)
|
||||
{
|
||||
B = range.AsPointer();
|
||||
E = B + range.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue